home *** CD-ROM | disk | FTP | other *** search
/ User's Choice Windows CD / User's Choice Windows CD (CMS Software)(1993).iso / win_u_z / wbt20a.zip / WINBATCH.TXT < prev    next >
Text File  |  1991-01-08  |  215KB  |  7,540 lines

  1.  
  2.  
  3.  
  4.  
  5.  
  6.  
  7.  
  8.                                                           WinBatch 1.0
  9.                                                          User's Manual
  10.  
  11.  
  12.  
  13.  
  14.  
  15.  
  16.  
  17.  
  18.  
  19.  
  20.  
  21.  
  22.  
  23.  
  24.             For IBM (R) PC/XT (R), PC/AT (R), PS/2 (R) and compatibles
  25.  
  26.  
  27.  
  28.  
  29.  
  30.  
  31.  
  32.  
  33.  
  34.  
  35.  
  36.  
  37.  
  38.                                                      Wilson WindowWare
  39.                                        2701 California Ave SW  ste 212
  40.                                                      Seattle, WA 98116
  41.  
  42.                                                  Orders:(800) 762-8383
  43.                                               Support:  (206) 937-9335
  44.                                                  Fax:   (206) 935-7129
  45.  
  46.  
  47.  
  48.  
  49.  
  50.                      Copyright 1988-1991 by Morrie Wilson.
  51.                               All rights reserved.
  52.  
  53.  
  54.  
  55.         No part of this manual may be reproduced or transmitted in any
  56.         form or by any means, electronic or mechanical, including
  57.         photocopying and recording, for any purpose without the
  58.         express written permission of Wilson WindowWare.  Information
  59.         in this document is subject to change without notice and does
  60.         not represent a commitment by Wilson WindowWare.
  61.  
  62.  
  63.         The software described herein is furnished under a license
  64.         agreement.  It is against the law to copy this software under
  65.         any circumstances except as provided by the license agreement.
  66.  
  67.  
  68.  
  69.  
  70.  
  71.  
  72.  
  73.  
  74.  
  75.  
  76.  
  77.  
  78.  
  79.         U.S. Government Restricted Rights
  80.  
  81.         Use, duplication, or disclosure by the Government is subject to
  82.         restrictions as set forth in subdivision (b)(3)(ii) of the Rights
  83.         in Technical Data and Computer Software clause at 252.227-7013.
  84.         Contractor/manufacturer is Wilson WindowWare/2701 California Ave
  85.         SW /ste 212/Seattle, WA 98116
  86.  
  87.  
  88.  
  89.         Trademarks
  90.  
  91.         IBM, PC/XT, PC/AT, and PS/2 are registered trademarks of
  92.         International Business Machines Corporation.
  93.         Microsoft and MS-DOS are registered trademarks of Microsoft
  94.         Corporation.
  95.         Windows, Word for Windows, and Excel are trademarks of Microsoft
  96.         Corporation.
  97.  
  98.         Scramble is a trademark of Diana Gruber.
  99.  
  100.         Command Post, WinBatch, and WinEdit are trademarks of Wilson
  101.         WindowWare.
  102.  
  103.  
  104.  
  105.  
  106.  
  107.  
  108.  
  109.  
  110.  
  111.         ii
  112.  
  113.                                                                  CONTENTS
  114.  
  115.  
  116.  
  117.  
  118.                                     CONTENTS
  119.  
  120.  
  121.         CONTENTS                                         iii
  122.  
  123.         INTRODUCTION                                     vii
  124.           System Requirements                            vii
  125.           About This Manual                              vii
  126.           Notational Conventions                        viii
  127.           Acknowledgements                              viii
  128.  
  129.         GETTING STARTED                                    1
  130.  
  131.         TUTORIAL                                           2
  132.           WinBatch Basics                                  2
  133.              What is a Batch File?                         2
  134.              Our First WinBatch File                       2
  135.              Functions and Parameters                      3
  136.              Displaying Text                               4
  137.              Getting Input                                 5
  138.              Using Variables                               6
  139.              Making Decisions                              7
  140.              Branching                                     9
  141.           Exploring WinBatch                              11
  142.              Running Programs                             11
  143.              Display and Input                            12
  144.              Manipulating Windows                         13
  145.              Files and Directories                        16
  146.              Handling Errors                              18
  147.              Selection Menus                              19
  148.              Nicer Dialog Boxes                           22
  149.              Running DOS Programs                         24
  150.              Sending Keystrokes to Programs               24
  151.              Our Completed WinBatch File                  25
  152.  
  153.         WINBATCH LANGUAGE                                 27
  154.           Language Components                             27
  155.              Constants                                    27
  156.              Identifiers                                  28
  157.              Variables                                    28
  158.              Keywords Are Reserved                        28
  159.              Operators                                    28
  160.              Precedence and evaluation order              29
  161.              Comments                                     30
  162.              Statements                                   30
  163.              Substitution                                 30
  164.           Function Parameters                             31
  165.           Error Handling                                  31
  166.           The Functions & Statements                      32
  167.              Inputting Information                        32
  168.              Displaying Information                       32
  169.              File Management                              32
  170.              Directory Management                         33
  171.  
  172.  
  173.  
  174.  
  175.                                                                       iii
  176.  
  177.         CONTENTS
  178.  
  179.  
  180.  
  181.              Disk Drive Management                        33
  182.              Window Management                            34
  183.              Program Management                           34
  184.              String Handling                              35
  185.              Arithmetic Functions                         36
  186.              Clipboard Handling                           36
  187.              System Control                               36
  188.  
  189.         WBL FUNCTION REFERENCE                            39
  190.           Introduction                                    39
  191.           Abs                                             40
  192.           AskLine                                         40
  193.           AskYesNo                                        41
  194.           Average                                         41
  195.           Beep                                            42
  196.           Call                                            42
  197.           CallExt                                         42
  198.           Char2Num                                        43
  199.           ClipAppend                                      43
  200.           ClipGet                                         44
  201.           ClipPut                                         45
  202.           DateTime                                        45
  203.           Debug                                           46
  204.           Delay                                           47
  205.           DialogBox                                       47
  206.           DirChange                                       47
  207.           DirGet                                          48
  208.           DirHome                                         48
  209.           DirItemize                                      49
  210.           DirMake                                         49
  211.           DirRemove                                       50
  212.           DiskFree                                        50
  213.           Display                                         51
  214.           DOSVersion                                      51
  215.           Drop                                            52
  216.           EndSession                                      52
  217.           Environment                                     53
  218.           ErrorMode                                       53
  219.           Execute                                         54
  220.           Exit                                            54
  221.           Exclusive                                       55
  222.           FileClose                                       55
  223.           FileCopy                                        56
  224.           FileDelete                                      56
  225.           FileExist                                       57
  226.           FileExtension                                   58
  227.           FileItemize                                     58
  228.           FileLocate                                      59
  229.           FileMove                                        60
  230.           FileOpen                                        60
  231.           FilePath                                        61
  232.           FileRead                                        61
  233.           FileRename                                      62
  234.           FileRoot                                        63
  235.  
  236.  
  237.  
  238.  
  239.         iv
  240.  
  241.                                                                  CONTENTS
  242.  
  243.  
  244.  
  245.           FileSize                                        63
  246.           FileWrite                                       64
  247.           Goto                                            64
  248.           If_Then                                         64
  249.           IgnoreInput                                     65
  250.           IniRead                                         65
  251.           IniReadPvt                                      66
  252.           IniWrite                                        66
  253.           IniWritePvt                                     67
  254.           IsDefined                                       67
  255.           IsKeyDown                                       68
  256.           IsLicensed                                      68
  257.           IsNumber                                        69
  258.           ItemSelect                                      69
  259.           LastError                                       70
  260.           LogDisk                                         71
  261.           Max                                             71
  262.           Message                                         72
  263.           Min                                             72
  264.           Num2Char                                        73
  265.           ParseData                                       73
  266.           Pause                                           74
  267.           Random                                          74
  268.           Return                                          74
  269.           Run                                             75
  270.           RunHide                                         75
  271.           RunIcon                                         76
  272.           RunZoom                                         77
  273.           SendKey                                         78
  274.           SKDebug                                         79
  275.           StrCat                                          80
  276.           StrCmp                                          80
  277.           StrFill                                         81
  278.           StrFix                                          81
  279.           StriCmp                                         82
  280.           StrIndex                                        83
  281.           StrLen                                          83
  282.           StrLower                                        84
  283.           StrReplace                                      84
  284.           StrScan                                         85
  285.           StrSub                                          86
  286.           StrTrim                                         86
  287.           StrUpper                                        87
  288.           TextBox                                         87
  289.           Version                                         88
  290.           WinActivate                                     88
  291.           WinArrange                                      89
  292.           WinClose                                        89
  293.           WinCloseNot                                     90
  294.           WinConfig                                       91
  295.           WinExist                                        91
  296.           WinGetActive                                    92
  297.           WinHide                                         92
  298.           WinIconize                                      93
  299.  
  300.  
  301.  
  302.  
  303.                                                                         v
  304.  
  305.         CONTENTS
  306.  
  307.  
  308.  
  309.           WinItemize                                      93
  310.           WinPlace                                        94
  311.           WinPosition                                     95
  312.           WinShow                                         96
  313.           WinTitle                                        96
  314.           WinVersion                                      97
  315.           WinWaitClose                                    97
  316.           WinZoom                                         98
  317.           Yield                                           99
  318.  
  319.         APPENDIX A  Predefined Constants                 100
  320.  
  321.         APPENDIX B  Errors                               101
  322.           Minor Errors                                   101
  323.           Moderate Errors                                101
  324.           Fatal Errors                                   102
  325.  
  326.         Index                                            107
  327.  
  328.  
  329.  
  330.  
  331.  
  332.  
  333.  
  334.  
  335.  
  336.  
  337.  
  338.  
  339.  
  340.  
  341.  
  342.  
  343.  
  344.  
  345.  
  346.  
  347.  
  348.  
  349.  
  350.  
  351.  
  352.  
  353.  
  354.  
  355.  
  356.  
  357.  
  358.  
  359.  
  360.  
  361.  
  362.  
  363.  
  364.  
  365.  
  366.  
  367.         vi
  368.  
  369.                                                              INTRODUCTION
  370.  
  371.  
  372.  
  373.  
  374.                                   INTRODUCTION
  375.  
  376.         WinBatch is a new batch language interpreter which brings the
  377.         power of batch language programming to the Windows environment.
  378.         WinBatch files can do pretty much everything the old DOS batch
  379.         files could do, but WinBatch goes far beyond the capabilities of
  380.         the DOS batch language.
  381.  
  382.         WinBatch files can:
  383.  
  384.           *  Run Windows and DOS programs.
  385.           *  Resize and rearrange windows.
  386.           *  Send keystrokes directly to applications.
  387.           *  Display information to the user in various formats.
  388.           *  Prompt the user for input.
  389.           *  Present scrollable file and directory lists.
  390.           *  Copy, move, delete, and rename files.
  391.           *  Read and write files directly.
  392.           *  Perform string and arithmetic operations.
  393.           *  Make branching decisions based upon numerous factors.
  394.  
  395.         And much, much more.
  396.  
  397.         Whether you are creating batch files for others, or looking for a
  398.         way to automate your own work and eliminate the drudgery of
  399.         repetitive tasks, you will find WinBatch to be a powerful,
  400.         versatile, and easy-to-use tool.
  401.  
  402.  
  403.         System Requirements
  404.  
  405.         WinBatch 1.0 requires an IBM PC or compatible with a minimum of
  406.         640K memory running Microsoft Windows version 3.0 or higher.
  407.  
  408.  
  409.         About This Manual
  410.  
  411.         This manual is divided into four sections:  First is Getting
  412.         Started (pg. 1), where we tell you how to install the program.
  413.         Then we offer an extensive Tutorial, to get both beginning and
  414.         advanced users quickly up to speed with creating WinBatch files
  415.         (pg. 21).  Then we describe the different elements of the
  416.         WinBatch Language (WBL) (pg. 27).  Finally, there is a
  417.         comprehensive WBL Function Reference (pg. 39), which contains
  418.  
  419.  
  420.  
  421.  
  422.  
  423.                                                                       vii
  424.  
  425.         INTRODUCTION
  426.  
  427.  
  428.  
  429.         detailed information on each of the WinBatch functions and
  430.         statements.
  431.  
  432.  
  433.         Notational Conventions
  434.  
  435.         Throughout this manual, we use the following conventions to
  436.         distinguish elements of text:
  437.  
  438.         ALL-CAPS
  439.           Used for filenames.
  440.  
  441.         Boldface
  442.           Used for important points, programs, function names, and parts
  443.           of syntax that must appear as shown.
  444.  
  445.         system
  446.           Used for menu items as they appear to the user.
  447.  
  448.         Small fixed-width
  449.           Used for batch file sample code.
  450.  
  451.  
  452.         Acknowledgements
  453.  
  454.         WinBatch 1.0 designed & written by Morrie Wilson.
  455.         User's Manual designed by Richard Merit.
  456.         Written by Richard Merit & Morrie Wilson.
  457.  
  458.         Our thanks to the many beta-testers for their invaluable comments
  459.         & suggestions.
  460.  
  461.  
  462.  
  463.  
  464.  
  465.  
  466.  
  467.  
  468.  
  469.  
  470.  
  471.  
  472.  
  473.  
  474.  
  475.  
  476.  
  477.  
  478.  
  479.  
  480.  
  481.  
  482.  
  483.  
  484.  
  485.  
  486.  
  487.  
  488.         viii
  489.  
  490.                                                           GETTING STARTED
  491.  
  492.  
  493.  
  494.  
  495.                                  GETTING STARTED
  496.  
  497.         WinBatch is quite easy to install.  You will find an appropriate
  498.         diskette in your WinBatch package.  Take the diskette and insert
  499.         it into your floppy drive.  The WinBatch installation program is
  500.         itself a Windows application, so make sure Windows is running.
  501.  
  502.         From the Program Manager, doubleclick on the File Manager icon to
  503.         run it.  When File Manager starts, click on the A: or B: drive
  504.         icon, depending on which floppy drive you used.  A directory tree
  505.         will appear for the WinBatch diskette.  You should see a root
  506.         directory icon.  Doubleclick on this icon and a list of filenames
  507.         will appear.  Find the filename SETUP.EXE and doubleclick on it.
  508.         Follow whatever instructions Setup gives you.
  509.         Setup will create the necessary files and place them into a
  510.         directory it will prompt you for.
  511.  
  512.         As the installation program finishes it will display the
  513.         README.TXT file.  You should take the time to read this file as
  514.         it contains any late-breaking information about your copy of
  515.         WinBatch.
  516.  
  517.  
  518.  
  519.  
  520.  
  521.  
  522.  
  523.  
  524.  
  525.  
  526.  
  527.  
  528.  
  529.  
  530.  
  531.  
  532.  
  533.  
  534.  
  535.  
  536.  
  537.  
  538.  
  539.  
  540.  
  541.  
  542.  
  543.  
  544.  
  545.  
  546.  
  547.  
  548.  
  549.  
  550.  
  551.  
  552.                                                                         1
  553.  
  554.         TUTORIAL
  555.  
  556.  
  557.  
  558.  
  559.                                     TUTORIAL
  560.  
  561.  
  562.  
  563.  
  564.         WinBatch Basics
  565.  
  566.  
  567.         What is a Batch File?
  568.  
  569.         A batch file, whether a DOS batch file or a WinBatch file, is
  570.         simply a list of commands for the computer to process.  Any task
  571.         which will be run more than once, or which requires entering many
  572.         commands or even a single complicated command, is a candidate for
  573.         a batch file.  For example, suppose you regularly enter the
  574.         following commands to start Windows:
  575.         First:
  576.  
  577.           cd\windows
  578.  
  579.         then:
  580.  
  581.           win
  582.  
  583.         and then:
  584.  
  585.           cd\
  586.  
  587.         Here, you are changing to the Windows directory, running Windows,
  588.         and then returning to the root directory.  Instead of having to
  589.         type these three commands every time you run Windows, you can
  590.         create a DOS batch file, called WI.BAT, which contains those
  591.         exact same commands:
  592.  
  593.           cd\windows
  594.           win
  595.           cd\
  596.  
  597.         Now, to start Windows, you merely need to type the single command
  598.         WI, which starts the WI.BAT batch file, which runs your three
  599.         commands.
  600.  
  601.         WinBatch files work the same way.
  602.  
  603.  
  604.         Our First WinBatch File
  605.  
  606.         Our first Winbatch file will simply start up our favorite Windows
  607.         application: Solitaire.  First, start up Notepad, or any other
  608.         editor which is capable of saving text in pure ASCII format (may
  609.         we suggest WinEdit, from Wilson WindowWare).  Next, enter the
  610.         following line:
  611.  
  612.           Run("sol.exe","")
  613.  
  614.         Save the file as SOLITARE.WBT.  Now, run SOLITARE.WBT by starting
  615.         or switching to the File Manager, and either moving the cursor to
  616.  
  617.  
  618.  
  619.  
  620.  
  621.         2
  622.  
  623.                                                                  TUTORIAL
  624.  
  625.  
  626.  
  627.         the file name and pressing Enter, or double-clicking on the file
  628.         name with your mouse.  Presto!  It's Solitaire.
  629.  
  630.         Okay, that wasn't very impressive.  But it did serve to
  631.         illustrate several important WinBatch points.  They are:
  632.  
  633.         1.  WinBatch files must be edited and saved in ASCII format.
  634.  
  635.         2.  WinBatch files should be created with a WBT extension.  When
  636.         WinBatch is first installed, it creates an entry in your WIN.INI
  637.         file which causes files with a WBT extension to be associated
  638.         with WinBatch.  As long as WINBATCH.EXE is located in your DOS
  639.         path, you can place WBT files in any directory and run them by
  640.         simply selecting them.
  641.  
  642.         3.  After you have created a WBT file, you run it by cursoring to
  643.         it and pressing Enter, or double-clicking on it with your mouse
  644.         (you can also add a WBT file to a program group and run it using
  645.         the Program Manager; see your Windows manual for further
  646.         information).  Whatever method you use, we'll use the term Run to
  647.         refer to selecting and running the file.
  648.  
  649.  
  650.         Functions and Parameters
  651.  
  652.         Now, let's look more closely at the line we entered:
  653.  
  654.           Run("sol.exe", "")
  655.  
  656.         The first part, Run, is a WinBatch function.  As you might have
  657.         guessed, its purpose is to run a Windows program.  There are over
  658.         a hundred functions and statements in WinBatch, and each has a
  659.         certain syntax which must be used.  The syntax for all WinBatch
  660.         functions may be found in the WBL Function Reference (pg. 39).
  661.         The entry for Run starts off as follows:
  662.  
  663.         Syntax:
  664.           Run (program-name, parameters)
  665.  
  666.         Parameters:
  667.           "program-name" =  the name of the desired .EXE, .COM, .PIF,
  668.                             .BAT file, or a data file.
  669.           "parameters" =    optional parameters as required by the
  670.                             application.
  671.  
  672.         Like all WinBatch functions, Run is followed by a number of
  673.         parameters, enclosed in parentheses.  Parameters are simply
  674.         additional information which are provided when a particular
  675.         function is used; they made either be required or optional.
  676.         Optional parameters are indicated by being enclosed in brackets.
  677.         In this case, Run has two required parameters: the program name,
  678.         and the parameters which get passed to the application.
  679.         There are several types of parameters which you can use.
  680.         Multiple parameters are separated by commas.  In the example
  681.  
  682.           Run("sol.exe", "")
  683.  
  684.  
  685.  
  686.  
  687.  
  688.                                                                         3
  689.  
  690.         TUTORIAL
  691.  
  692.  
  693.  
  694.         "sol.exe" and "" are both string constants.  String constants can
  695.         be identified by the quote marks which delimit (surround) them
  696.         (you may use either double ("), single forward (') or single back
  697.         (`) quote marks as string delimiters; the examples in this manual
  698.         will use double quotes).
  699.  
  700.         You may have noticed how we said earlier that the two parameters
  701.         for the Run function are required, and yet the entry for Run in
  702.         the WBL Function Reference describes the second parameter --
  703.         "parameters" -- as being optional.  Which is correct?  Well, from
  704.         a language standpoint, the second parameter is required.  That
  705.         is, if you omit it, you will get a syntax error, and your batch
  706.         file will not run properly.  However, the program that you are
  707.         running may not need any parameters.  Solitaire, for example,
  708.         does not take any parameters.  The way we handle this in our
  709.         batch file is to specify an empty string -- two quote marks with
  710.         nothing in between -- as the second parameter, as we have done in
  711.         our example above.
  712.  
  713.         To illustrate this further, let's create a WinBatch file called
  714.         EDIT.WBT, containing the following line:
  715.  
  716.           Run("notepad.exe", "")
  717.  
  718.         This is just like our previous file, with only the name of the
  719.         program changed.  Save the file, and run it.  You should now be
  720.         in Notepad.  Now edit the EDIT.WBT file as follows:
  721.  
  722.           Run("notepad.exe", "solitare.wbt")
  723.  
  724.         Save the file, exit Notepad, and run EDIT.WBT again.  You should
  725.         now be in Notepad, with SOLITARE.WBT loaded.  As we've just
  726.         demonstrated, Notepad is an example of a program which can be run
  727.         with or without a file name parameter passed to it by WinBatch.
  728.  
  729.         Before you leave Notepad, modify EDIT.WBT as follows:
  730.  
  731.           ; This is an example of the Run function in WinBatch
  732.           Run("notepad.exe", "solitare.wbt")
  733.  
  734.         The semicolon at the beginning of the first line signifies a
  735.         comment, and causes that line to be ignored.  You can place
  736.         comment lines, and/or blank lines anywhere in your WinBatch
  737.         files.  In addition, you can place a comment on the same line as
  738.         a function by preceding the comment with a semicolon.  For
  739.         example:
  740.  
  741.           Run("sol.exe", "")     ;this is a very useful function
  742.  
  743.         Everything to the right of a semicolon is ignored.  However, if a
  744.         semicolon appears in a string delimited by quotes, it is
  745.         considered part of the string.
  746.  
  747.  
  748.         Displaying Text
  749.  
  750.         Now, let's modify our SOLITARE.WBT file as follows.  You might as
  751.         well use the EDIT.WBT batch file you created earlier to start up
  752.         Notepad:
  753.  
  754.  
  755.  
  756.  
  757.  
  758.         4
  759.  
  760.                                                                  TUTORIAL
  761.  
  762.  
  763.  
  764.           ; solitare.wbt
  765.           Display(5, "Good Luck!", "Remember ... it's only a game.")
  766.           Run("sol.exe", "")
  767.  
  768.         And run it.  Notice the message box which pops up on the screen
  769.         with words of encouragement.  That's done by the Display function
  770.         in the second line above.  Here's the reference for the Display
  771.         function:
  772.  
  773.         Syntax:
  774.           Display (seconds, title, text)
  775.  
  776.         Parameters:
  777.           seconds = integer seconds to display the message (1-15).
  778.           "title" = Title of the window to be displayed.
  779.           "text" =  Text of the window to be displayed.
  780.         
  781.         Note that the Display function has three parameters.  The first
  782.         parameter -- in our example, 5 -- is the number of seconds which
  783.         the message box will remain on the screen (you can also make the
  784.         box disappear by pressing a key or mouse button).  This is a
  785.         numeric constant, and -- unlike a string constants -- it does not
  786.         need to be enclosed in quotes (although it can be, if you wish,
  787.         as WinBatch will automatically try to convert string variables to
  788.         numeric variables when necessary, and vice versa).  The second
  789.         parameter is the title of the message box, and the third
  790.         parameter is the actual text displayed in the box.  Now, exit
  791.         Solitaire (if you haven't already done so), and edit SOLITARE.WBT
  792.         by placing a semicolon at the beginning of the line with the Run
  793.         function.  This is a handy way to disable, or "comment out,"
  794.         lines in your WinBatch files when you want to modify and test
  795.         only selected segments.  Your SOLITARE.WBT file should look like
  796.         this:
  797.  
  798.           ; solitare.wbt
  799.           Display(5, "Good Luck!", "Remember ... it's only a game.")
  800.           ;Run("sol.exe", "")
  801.  
  802.         Now, experiment with modifying the parameters in the Display
  803.         function.  Try adjusting the value of the first parameter.  If
  804.         you look up Display in the WBL reference section, you will notice
  805.         that the acceptable values for this parameter are 1-15.  If you
  806.         try to use a value outside this range, WinBatch will adjust it to
  807.         "make it fit"; that is, it will treat numbers less than 1 as 1,
  808.         and numbers greater than 15 as 15.  Try it.  Also, try giving it
  809.         a non-integer, such as 2.5, and see what happens.  Play around
  810.         with the text in the two string parameters; try making one, or
  811.         both, empty strings ("").
  812.  
  813.  
  814.         Getting Input
  815.  
  816.         Now, let's look at ways of getting input from a user and making
  817.         decisions based on that input.  The most basic form of input is a
  818.         simple Yes/No response, and, indeed, there is a WinBatch function
  819.         called AskYesNo:
  820.  
  821.  
  822.  
  823.  
  824.                                                                         5
  825.  
  826.         TUTORIAL
  827.  
  828.  
  829.  
  830.         Syntax:
  831.           AskYesNo (title, question)
  832.  
  833.         Parameters
  834.           "title" = title of the question box.
  835.           "question" = question to be put to the user.
  836.  
  837.         Returns:
  838.           (integer) @YES or @NO, depending on the button pressed.
  839.  
  840.         You should be familiar with the standard syntax format by now; it
  841.         shows us that AskYesNo has two required parameters.  The
  842.         Parameters section tells us that these parameters both take
  843.         strings (indicated by the quote marks), and tells us what each of
  844.         the parameters means.
  845.  
  846.         You will notice that there is also a new section here, titled
  847.         Returns.  This selection shows you the possible values that may
  848.         be returned by this function.  All functions return values.  In
  849.         the case of Run and Display, we weren't concerned with the values
  850.         that those functions returned.  But with AskYesNo, the returned
  851.         value is very important, because we will need that information to
  852.         decide how to proceed.  We see that AskYesNo returns an integer
  853.         value.  An integer is simply a non-decimal number, such as 0, 1,
  854.         or 2.  The number 1.5 is not an integer.  We see further that the
  855.         integer value returned by AskYesNo is either @YES or @NO.  @YES
  856.         and @NO are predefined constants in WinBatch.  All predefined
  857.         constants begin with an @ symbol, and we will distinguish them
  858.         further by typing them in all caps.  You will find a list of all
  859.         predefined constants in Appendix A (pg. 100).  Even though the
  860.         words "Yes" and "No" are strings, it is important to remember
  861.         that the predefined constants @YES and @NO are not string
  862.         variables (in fact, they are integers).
  863.  
  864.         Now, let's modify our SOLITARE.WBT file as follows:
  865.  
  866.           AskYesNo("Really?", "Do you really want to play Solitaire
  867.             now?")
  868.           Run("sol.exe", "")
  869.  
  870.         and run it.  You should have gotten a nice dialog box which asked
  871.         if you wanted to play Solitaire, but no matter what you answered,
  872.         it started Solitaire anyway.  This isn't good.  We need a way to
  873.         use the Yes/No response to determine further processing.  First,
  874.         we need to explore the concept and use of variables.
  875.  
  876.  
  877.         Using Variables
  878.  
  879.         A variable is simply a placeholder for a value.  The value that
  880.         the variable stands for can be either a text string (string
  881.         variable) or a number (numeric variable).  If you remember
  882.         Algebra 101, you know that if X=3, then X+X=6.  X is simply a
  883.         numeric variable, which stands here for the number 3.  If we
  884.         change the value of X to 4 (X=4), then the expression X+X is now
  885.         equal to 8.  By the same token, we can say that if Y="morning",
  886.         then "good"+Y="good morning".  If we change the value of Y to
  887.  
  888.  
  889.  
  890.  
  891.         6
  892.  
  893.                                                                  TUTORIAL
  894.  
  895.  
  896.  
  897.         "afternoon", then the result of our expression is now "good
  898.         afternoon".  Clear so far?
  899.  
  900.         Now, we know that the AskYesNo function returns a value of either
  901.         @YES or @NO.  What we need to do is create a variable to store
  902.         the value that AskYesNo returns, so that we can use it later on.
  903.         First, we need to give this variable a name.  In WinBatch,
  904.         variable names must begin with a letter, may contain any
  905.         combination of letters or numbers, and may be from 1 to 30
  906.         characters long.  So, let's use a variable called 'response' (we
  907.         will distinguish variable names in this text by typing them in
  908.         all lowercase letters; we will type function and statement names
  909.         starting with a capital letter.  However, in WinBatch, the case
  910.         is irrelevant, so you can use all lowercase, or all uppercase, or
  911.         whatever combination you prefer).  We assign the value returned
  912.         by the AskYesNo function to the variable called 'response' as
  913.         follows:
  914.  
  915.           response = AskYesNo("Really?", "Do you really want to play
  916.             Solitaire now?")
  917.  
  918.         Notice the syntax.  The way that WinBatch process this line is to
  919.         first evaluate the result of the AskYesNo function.  The function
  920.         returns a value of either @YES or @NO.  Then, WinBatch assigns
  921.         this returned value to 'response'.  Therefore, 'response' is now
  922.         equal to @YES or @NO.
  923.  
  924.         Now, all we need is a way to make a decision based upon this
  925.         variable.
  926.  
  927.  
  928.         Making Decisions
  929.  
  930.         WinBatch provides a way to conditionally execute a statement.
  931.         The way this is done is with the If ... Then statement.
  932.         Actually, there are two parts to this construct: If and Then
  933.         (naturally).  The format is:
  934.  
  935.           If condition Then function
  936.  
  937.         The use of If ... Then can be illustrated easily by going back to
  938.         our SOLITARE.WBT file, and making these modifications:
  939.  
  940.           response = AskYesNo("Really?", "Do you really want to play
  941.             Solitaire now?")
  942.           If response == @YES Then Run("sol.exe", "")
  943.  
  944.         As you can see, we are using If ... Then to test whether the
  945.         response to the question posed in AskYesNo is @YES.  If it is
  946.         @YES, then we start Solitaire.  If it's not @YES, then we don't
  947.         start Solitaire.  The rule is: if the condition following the If
  948.         keyword is true, then the function following the Then keyword is
  949.         performed.  If the condition following the If keyword is false,
  950.         then anything following the Then keyword is ignored
  951.         There is something extremely important that you should note about
  952.         the condition following the If keyword: the double equal signs
  953.         (==).  In WinBatch, a single equal sign (=) is an assignment
  954.  
  955.  
  956.  
  957.  
  958.  
  959.                                                                         7
  960.  
  961.         TUTORIAL
  962.  
  963.  
  964.  
  965.         operator -- it assigns the value on the right of the equal sign
  966.         to the variable on the left of the equal sign.  As in:
  967.  
  968.           response = AskYesNo("Really?", "Do you really want to play
  969.             Solitaire now?")
  970.  
  971.         This is saying, in English: "Assign the value returned by the
  972.         AskYesNo function to the variable called 'response'."  But in the
  973.         statement:
  974.  
  975.           If response == @YES Then Run("sol.exe", "")
  976.  
  977.         we do not want to assign a new value to response, we merely want
  978.         to test whether it is equal to @YES.  Therefore, we use the
  979.         double equal sign (==), which is the equality operator in
  980.         WinBatch.  The statement above is saying, in English: "If the
  981.         value of the variable called 'response' is equal to @YES, then
  982.         run the program SOL.EXE."  What would happen if we used a single
  983.         equal sign (=) here instead?  Well, since the single equal sign
  984.         (=) is the assignment operator, Winbatch would first assign the
  985.         value @YES to the variable 'response'.  Then, it would perform
  986.         the If function by testing the condition following the keyword
  987.         If.  Since an assignment operation always results in a true
  988.         condition, the condition following the If keyword would always be
  989.         true, and the function following the Then keyword would always be
  990.         performed, regardless of the value of AskYesNo.
  991.  
  992.         If you've become confused now, just remember that a single equal
  993.         sign (=) is an assignment operator, used to assign a value to a
  994.         variable.  A double equal sign (==) is an equality operator, used
  995.         to test whether the values on both sides of the operator are the
  996.         same.  If you ever have a problem with one of your WinBatch
  997.         files, the first thing you check should be whether you've used
  998.         '=' instead of '=='.  We cannot emphasize this too strongly!
  999.         We've seen what happens when the condition following the Then
  1000.         keyword is true.  But what happens when it is false?  Remember we
  1001.         said that when the If condition is false, the Then function is
  1002.         ignored.  There will be times, however when we want to perform an
  1003.         alternate action in this event.  For example, suppose we want to
  1004.         display a message if the user decides he or she doesn't want to
  1005.         play Solitaire.  We could say:
  1006.  
  1007.           response = AskYesNo("Really?", "Do you really want to play
  1008.             Solitaire now?")
  1009.           If response == @YES Then Run("sol.exe", "")
  1010.           If response == @NO Then Display(5, "Game Canceled", "Smart
  1011.             move ... I think the boss is standing behind you.")
  1012.  
  1013.         In this case there are two If statements being evaluated, with
  1014.         one and only one of them possibly being true (unless the user
  1015.         selected the Cancel button, which would abort the batch file
  1016.         entirely).  However, this is not very efficient from a processing
  1017.         point of view.  Furthermore, what would happen if you had several
  1018.         functions you wanted to perform if the user answered 'Yes'?  You
  1019.         would end up with something unwieldy, like:
  1020.  
  1021.  
  1022.  
  1023.  
  1024.  
  1025.  
  1026.         8
  1027.  
  1028.                                                                  TUTORIAL
  1029.  
  1030.  
  1031.  
  1032.           response = AskYesNo("Really?", "Do you really want to play
  1033.             Solitaire now?")
  1034.           If response == @YES Then Display(5, "", "On your mark ...")
  1035.           If response == @YES Then Display(5, "", "Get set ...")
  1036.           If response == @YES Then Display(5, "", "Go!")
  1037.           If response == @YES Then Run("sol.exe", "")
  1038.  
  1039.         Clearly, there must be a better way of handling this.
  1040.  
  1041.  
  1042.         Branching
  1043.  
  1044.         Enter the Goto function.  Goto, in combination with If ... Then,
  1045.         gives you complete control over the flow of control in your
  1046.         WinBatch files.  Goto does exactly what it says -- it causes the
  1047.         flow of control to go to another point in the batch file.  You
  1048.         must specify where you want the flow of control to be
  1049.         transferred, and you must mark this point with a label.  A label
  1050.         is simply a destination address.  The form of the Goto function
  1051.         is:
  1052.  
  1053.           Goto label
  1054.  
  1055.         where label is an identifier that you specify.  The same rules
  1056.         apply to label names as to variable names (the first character
  1057.         must be a letter, the label name may consist of any combination
  1058.         of letters and numbers, and the label name may be from 1 to 30
  1059.         characters long).  In addition, the label is preceded by a colon
  1060.         at the point where it is being used as a destination address.
  1061.         Here's an example:
  1062.  
  1063.           response = AskYesNo("Really?", "Do you really want to play
  1064.             Solitaire now?")
  1065.           If response == @NO Then Goto quit
  1066.           Display(5, "", "On your mark ...")
  1067.           Display(5, "", "Get set ...")
  1068.           Display(5, "", "Go!")
  1069.           Run("sol.exe", "")
  1070.           :quit
  1071.  
  1072.         If the If condition is true (that is, the user answered 'No'),
  1073.         then the Goto function is performed.  The Goto statement is
  1074.         saying, in English "go to the line marked ':quit' and continue
  1075.         processing from there."  Notice how the label 'quit' is preceded
  1076.         by colon on the last line, but not on the line with the Goto
  1077.         function.  This is important.  Although you can have multiple
  1078.         lines in your batch file which say 'Goto quit', you can have only
  1079.         one line marked ':quit'.  Of course, you can use many different
  1080.         labels in a batch file, just as you can use many different
  1081.         variables, as long as each has a unique name.  For example:
  1082.  
  1083.           response = AskYesNo("Really?", "Do you really want to play
  1084.             Solitaire now?")
  1085.           If response == @NO Then Goto quit
  1086.           Display(5, "", "On your mark ...")
  1087.           Display(5, "", "Get set ...")
  1088.           Display(5, "", "Go!")
  1089.  
  1090.  
  1091.  
  1092.  
  1093.                                                                         9
  1094.  
  1095.         TUTORIAL
  1096.  
  1097.  
  1098.  
  1099.           Run("sol.exe", "")
  1100.           Goto done
  1101.           :quit
  1102.           Display(5, "Game Canceled", "Smart move ... I think the boss
  1103.             is standing behind you.")
  1104.           :done
  1105.  
  1106.         This is a little more complicated.  It uses two labels, 'quit'
  1107.         and 'done'.  If the user answers 'No', then the If condition is
  1108.         true, control passes to the line marked ':quit', and a message is
  1109.         displayed.  If, on the other hand, the user answers 'Yes', then
  1110.         the If condition is false, and the 'Goto quit' line is ignored.
  1111.         Instead, the next four lines are processed, and then the 'Goto
  1112.         done' line is unconditionally performed.  The purpose of this
  1113.         line is to bypass the Display line which follows by transferring
  1114.         control to the end of the batch file.  There is another way to
  1115.         keep your batch file processing from "falling through" to
  1116.         unwanted lines at the end of a program, and that is with the Exit
  1117.         function.  Exit causes a batch file to end immediately.  So, for
  1118.         example, we could rewrite the above batch file as follows:
  1119.  
  1120.           response = AskYesNo("Really?", "Do you really want to play
  1121.             Solitaire now?")
  1122.           If response == @NO Then Goto quit
  1123.           Display(5, "", "On your mark ...")
  1124.           Display(5, "", "Get set ...")
  1125.           Display(5, "", "Go!")
  1126.           Run("sol.exe", "")
  1127.           Exit
  1128.           :quit
  1129.           Display(5, "Game Canceled", "Smart move ... I think the boss
  1130.             is standing behind you.")
  1131.  
  1132.         Since the Run function is the last thing we want to do if the
  1133.         user answers 'Yes', the Exit function simply ends the program at
  1134.         that point.  Note that we could put an Exit function at the end
  1135.         of the program as well, but it isn't necessary.  An Exit is
  1136.         implied at the end of a WinBatch program.
  1137.  
  1138.  
  1139.         This concludes the first part of our tutorial.  You now have the
  1140.         building blocks you need to create useful WinBatch files.  In the
  1141.         second part, which follows, we will look at a some of the
  1142.         WinBatch functions which are available for your use.
  1143.  
  1144.  
  1145.  
  1146.  
  1147.  
  1148.  
  1149.  
  1150.  
  1151.  
  1152.  
  1153.  
  1154.  
  1155.  
  1156.  
  1157.  
  1158.         10
  1159.  
  1160.                                                                  TUTORIAL
  1161.  
  1162.  
  1163.  
  1164.  
  1165.  
  1166.  
  1167.         Exploring WinBatch
  1168.  
  1169.         What follows is just a sample of the functions and statements
  1170.         available in WinBatch.  These should be sufficient to begin
  1171.         creating versatile and powerful batch files.  For complete
  1172.         information on these and all WinBatch functions and statements,
  1173.         refer to the WBL Function Reference (pg. 39).
  1174.  
  1175.  
  1176.         Running Programs
  1177.  
  1178.         There are three functions which you can use to start an
  1179.         application, each of which shares a common syntax:
  1180.  
  1181.  
  1182.         Run (program-name, parameters)
  1183.  
  1184.         We've already seen the Run function.  This function starts a
  1185.         program in a "normal" window.  Windows decides where to place the
  1186.         application's  window on the screen.
  1187.         Example:
  1188.  
  1189.            Run("Notepad.exe", "myfile.txt")
  1190.  
  1191.         If the program has an EXE extension, its extension may be
  1192.         omitted:
  1193.  
  1194.            Run("Notepad", "myfile.txt")
  1195.  
  1196.         Also, you can "run" data files if they have an extension in
  1197.         WIN.INI which is associated with a program.  So, if TXT files are
  1198.         associated with Notepad:
  1199.  
  1200.            Run("myfile.txt", "")
  1201.  
  1202.         would start Notepad, using the file MYFILE.TXT.
  1203.  
  1204.         When you specify a file to run, WinBatch looks first in the
  1205.         current directory, and then in the directories on your DOS Path.
  1206.         If the file is not found, WinBatch will return an error.  You can
  1207.         also specify a full path name for WinBatch to use, as in:
  1208.  
  1209.            Run("c:\windows\apps\winedit.exe", "")
  1210.  
  1211.  
  1212.         RunZoom (program-name, parameters)
  1213.  
  1214.         RunZoom is like Run, but it starts a program as a full-screen
  1215.         window.
  1216.  
  1217.         Example:
  1218.  
  1219.            RunZoom("excel", "bigsheet.xls")
  1220.  
  1221.  
  1222.         RunIcon (program-name, parameters)
  1223.  
  1224.         RunIcon starts a program as an icon at the bottom of the screen.
  1225.         Example:
  1226.  
  1227.            RunIcon("clock", "")
  1228.  
  1229.  
  1230.  
  1231.  
  1232.  
  1233.  
  1234.                                                                        11
  1235.  
  1236.         TUTORIAL
  1237.  
  1238.  
  1239.  
  1240.  
  1241.         Display and Input
  1242.  
  1243.         Here we have functions which display information to the user and
  1244.         prompt the user for information, plus a couple of relevant system
  1245.         functions.
  1246.  
  1247.  
  1248.         Display (seconds, title, text)
  1249.  
  1250.         Displays a message to the user for a specified time.  The message
  1251.         will disappear after the time expires, or after any keypress or
  1252.         mouse click.
  1253.         Example:
  1254.  
  1255.            Display(2, "", "Loading Solitaire now")
  1256.  
  1257.  
  1258.         Message (title, text)
  1259.  
  1260.         This command displays a message box with a title and text you
  1261.         specify, until the user presses the OK button.
  1262.  
  1263.         Example:
  1264.  
  1265.            Message("Sorry", "That file cannot be found")
  1266.  
  1267.  
  1268.         Pause (title, text)
  1269.  
  1270.         This command is similar to Message, except an exclamation-point
  1271.         icon appears in the message box, and the user can press OK or
  1272.         Cancel.  If the user presses Cancel, the batch file exits.
  1273.         Example:
  1274.  
  1275.            Pause("Delete Backups", "Last chance to stop!")
  1276.            ;if batch file gets this far, the user pressed OK
  1277.            FileDelete("*.bak")
  1278.  
  1279.  
  1280.         AskYesNo (title, question)
  1281.  
  1282.         Displays a dialog box with a given title, which presents the user
  1283.         with three buttons: Yes, No, and Cancel.  If the user selects the
  1284.         Cancel button, the batch file is terminated.
  1285.  
  1286.         Example:
  1287.  
  1288.            response = AskYesNo("End Session", "Are you sure you want to
  1289.              leave Windows?"
  1290.  
  1291.  
  1292.         AskLine (title, prompt, default)
  1293.  
  1294.         Displays a dialog box with a given title, which prompts the user
  1295.         for a line of input.  Returns the default if the user just
  1296.         presses the OK button.
  1297.         Example:
  1298.  
  1299.            yourfile = AskLine("Edit File", "Filename:", "newfile.txt")
  1300.            Run("notepad", yourfile)
  1301.  
  1302.         If you specify a default entry (in this case, NEWFILE.TXT), it
  1303.         will appear in the response box, and will be replaced with
  1304.         whatever the user types.
  1305.  
  1306.  
  1307.         Beep
  1308.  
  1309.         Beeps once.
  1310.  
  1311.  
  1312.  
  1313.  
  1314.         12
  1315.  
  1316.                                                                  TUTORIAL
  1317.  
  1318.  
  1319.  
  1320.           Beep
  1321.  
  1322.         And if one beep isn't enough for you:
  1323.  
  1324.           Beep
  1325.           Beep
  1326.           Beep
  1327.  
  1328.  
  1329.         Delay (seconds)
  1330.  
  1331.         Pauses batch file execution.
  1332.         The Delay function lets you suspend batch file processing for 1
  1333.         to 15 seconds.  Again, you can use multiple occurrences for a
  1334.         longer delay:
  1335.  
  1336.           Delay(15)
  1337.           Delay(15)
  1338.  
  1339.         Will insert a 30-second pause.
  1340.  
  1341.  
  1342.         Manipulating Windows
  1343.  
  1344.         There are a large number of functions which allow you to manage
  1345.         the windows on your desktop.  Here are some of them:
  1346.  
  1347.  
  1348.         WinZoom (partial-windowname)
  1349.  
  1350.         Maximizes an application window to full-screen.
  1351.  
  1352.  
  1353.         WinIconize (partial-windowname)
  1354.  
  1355.         Turns an application window into an icon.
  1356.  
  1357.  
  1358.         WinShow (partial-windowname)
  1359.  
  1360.         Shows a window in its "normal" state.
  1361.  
  1362.  
  1363.         These three functions are used to modify the size of an already-
  1364.         running window.  WinZoom is the equivalent of selecting Maximize
  1365.         from a window's control (space-bar) menu, WinIconize is the same
  1366.         as selecting Minimize, and WinShow has the same effect as
  1367.         selecting Restore.
  1368.  
  1369.         The window that you are performing any of these functions on does
  1370.         not have to be the active window.  If the specified window is in
  1371.         the background, and the WinZoom or WinShow function causes the
  1372.         size of the window to change, then the window will be brought to
  1373.         the foreground.  The WinZoom function has no effect on a window
  1374.         which is already maximized, and WinShow has no effect on an
  1375.         already-"normal" window.
  1376.  
  1377.         Each of these functions takes a partial windowname as a
  1378.         parameter.  The "windowname" is the name which appears in the
  1379.         title bar at the top of the window.  You can specify the full
  1380.         name if you wish, but it may often be advantageous not to have to
  1381.  
  1382.  
  1383.  
  1384.  
  1385.  
  1386.                                                                        13
  1387.  
  1388.         TUTORIAL
  1389.  
  1390.  
  1391.  
  1392.         do so.  For example, if you are editing the file SOLITARE.WBT in
  1393.         a Notepad window open, the windowname will be
  1394.  
  1395.           Notepad - SOLITARE.WBT
  1396.  
  1397.         You probably don't want to have to hard-code this name into your
  1398.         batch file:
  1399.  
  1400.           WinZoom("Notepad - SOLITARE.WBT")
  1401.  
  1402.         Instead, you can specify the partial windowname 'Notepad':
  1403.  
  1404.           WinZoom("Notepad")
  1405.  
  1406.         If you have more than one Notepad window open, WinBatch will use
  1407.         the first one it finds.
  1408.  
  1409.         Note that WinBatch matches the partial windowname starting with
  1410.         the first character, so that while
  1411.  
  1412.           WinZoom("Note")
  1413.  
  1414.         would be correct,
  1415.  
  1416.           WinZoom("pad")
  1417.  
  1418.         would not result in a match.
  1419.  
  1420.         Also, be aware that the case of the title (upper or lower) is
  1421.         significant, so:
  1422.  
  1423.           WinZoom("notepad")
  1424.  
  1425.         would be invalid.
  1426.  
  1427.  
  1428.         WinActivate (partial-windowname)
  1429.  
  1430.         Makes an application window the active window.
  1431.         This function makes a currently-open window the active window.
  1432.         If the specified window is an icon, it will be restored to normal
  1433.         size; otherwise, its size will not be changed.
  1434.  
  1435.  
  1436.         WinClose (partial-windowname)
  1437.  
  1438.         Closes an application window.
  1439.  
  1440.  
  1441.         WinCloseNot (partial-windowname [, partial-windowname]...)
  1442.  
  1443.         Closes all application windows except those specified.
  1444.  
  1445.         This function lets you close all windows except the one(s) you
  1446.         specify.  For example:
  1447.  
  1448.           WinCloseNot("Program Man")
  1449.  
  1450.         would leave only the Program Manager open, and:
  1451.  
  1452.           WinCloseNot("Program Man, Solit")
  1453.  
  1454.  
  1455.  
  1456.  
  1457.  
  1458.         14
  1459.  
  1460.                                                                  TUTORIAL
  1461.  
  1462.  
  1463.  
  1464.         would leave the Program Manager and Solitaire windows open.
  1465.  
  1466.  
  1467.         WinWaitClose (partial-windowname)
  1468.  
  1469.         Waits until an application window is closed.
  1470.         This function causes your WinBatch file to pause until you have
  1471.         manually closed a specified window.  This is a very convenient
  1472.         way to have a WinBatch file open several windows sequentially,
  1473.         without having unnecessary windows open all over your desktop.
  1474.         For example:
  1475.  
  1476.           RunZoom("invoices.xls", "") ;balance the books
  1477.           WinWaitClose("Microsoft Ex")  ;wait till Excel closed
  1478.           RunZoom("sol", "")          ;you deserve a break
  1479.           WinWaitClose("Solitaire")     ;wait until Sol closed
  1480.           Run("winword", "agenda.doc")  ;more paperwork
  1481.           WinWaitClose("Microsoft Wor") ;wait until W4W closed
  1482.           Run("clock","")             ;lunchtime yet?
  1483.  
  1484.         During the time that the batch file is suspended, the WinBatch
  1485.         icon will remain at the bottom of your screen.  You can cancel
  1486.         the batch file at any time by selecting the icon and then
  1487.         selecting "Terminate" from the menu.
  1488.  
  1489.  
  1490.         WinExist (partial-windowname)
  1491.  
  1492.         Tells if Window exists.
  1493.  
  1494.         This function returns @TRUE or @FALSE, depending on whether a
  1495.         matching window can be found.  This gives you a very handy method
  1496.         of insuring that only one copy of a given window will be open at
  1497.         a time.
  1498.  
  1499.         If you've been following this tutorial faithfully from the
  1500.         beginning, you probably have several copies of Solitaire running
  1501.         at the moment.  You can check by pressing Ctrl-Esc now.  You say
  1502.         you've got 5 Solitaire windows open?  Okay, close them all.  Now,
  1503.         let's modify our SOLITARE.WBT file.  First, trim out the excess
  1504.         lines so that it looks like this:
  1505.  
  1506.           Run("sol.exe", "")
  1507.  
  1508.         Now, let's use the WinExist function to make sure that WinBatch
  1509.         only starts Solitaire if it isn't already running:
  1510.  
  1511.           If WinExist("Solitaire") == @FALSE Then Run("sol.exe", "")
  1512.  
  1513.         And this should work fine.  Run SOLITARE.WBT twice now, and see
  1514.         what happens.  The first time you run it, it should start
  1515.         Solitaire; the second (and subsequent) time, it should not do
  1516.         anything.
  1517.  
  1518.         However, it's quite likely that you want the batch file to do
  1519.         something if Solitaire is already running -- namely, bring the
  1520.         Solitaire window to the foreground.  This can be accomplished
  1521.  
  1522.  
  1523.  
  1524.  
  1525.  
  1526.                                                                        15
  1527.  
  1528.         TUTORIAL
  1529.  
  1530.  
  1531.  
  1532.         easily by using the WinActivate function, along with a couple of
  1533.         Goto statements, as follows:
  1534.  
  1535.           If WinExist("Solitaire") == @FALSE Then Goto open
  1536.           WinActivate("Solitaire")
  1537.           Goto loaded
  1538.           :open
  1539.           Run("sol.exe", "")
  1540.           :loaded
  1541.  
  1542.         Note that we can change this to have WinExist check for a 'True'
  1543.         value instead, by modifying the structure of the batch file, as
  1544.         follows:
  1545.  
  1546.           If WinExist("Solitaire") == @TRUE Then Goto activate
  1547.           Run("sol.exe", "")
  1548.           Goto loaded
  1549.           :activate
  1550.           WinActivate("Solitaire")
  1551.           :loaded
  1552.  
  1553.         Either format is perfectly correct, and the choice of which to
  1554.         use is merely a matter of personal style.  The result is exactly
  1555.         the same.
  1556.  
  1557.  
  1558.         EndSession ( )
  1559.  
  1560.         Ends the current Windows session.
  1561.         This does exactly what it says.  It will not ask any questions,
  1562.         so you may want to build in a little safety net:
  1563.  
  1564.           Sure = AskYesNo("End Session", "Are you sure you want to exit
  1565.             Windows?")
  1566.           If Sure == @YES Then EndSession()
  1567.  
  1568.  
  1569.         Files and Directories
  1570.  
  1571.  
  1572.         DirChange (pathname)
  1573.  
  1574.         Changes the directory to the pathname specified.
  1575.         Use this function when you want to run a program which must be
  1576.         started from its own directory.  'Pathname' may optionally
  1577.         include a drive letter.
  1578.  
  1579.         Example:
  1580.  
  1581.            DirChange("c:\windows\winword")
  1582.            Run("winword.exe", "")
  1583.  
  1584.  
  1585.         DirGet ( )
  1586.  
  1587.         Gets the Current Working Directory.
  1588.  
  1589.         This function is especially useful when used in conjunction with
  1590.         DirChange, to save and then return to the current directory.
  1591.  
  1592.  
  1593.  
  1594.  
  1595.  
  1596.  
  1597.         16
  1598.  
  1599.                                                                  TUTORIAL
  1600.  
  1601.  
  1602.  
  1603.         Example:
  1604.  
  1605.           origdir = DirGet()
  1606.           DirChange("c:\windows\winword")
  1607.           Run("winword.exe", "")
  1608.           DirChange(origdir)
  1609.  
  1610.  
  1611.         FileExist (filename)
  1612.  
  1613.         Determines if a file exists.
  1614.  
  1615.         This function will return @TRUE if the specified file exists, and
  1616.         @FALSE if it doesn't exist.
  1617.         Example:
  1618.  
  1619.            If FileExist("win.bak") == @FALSE Then FileCopy("win.ini",
  1620.              "win.bak")
  1621.            Run("notepad.exe", "win.ini")
  1622.  
  1623.  
  1624.         FileCopy (from-list, to-file, warning)
  1625.  
  1626.         Copies files.
  1627.  
  1628.         If warning is @TRUE, WinEdit will pop up a dialog box warning you
  1629.         if you are about to overwrite an existing file, and giving you an
  1630.         opportunity to change your mind.  If warning is @FALSE, it won't.
  1631.         Example:
  1632.  
  1633.            FileCopy("cmdpost.cpm", "*.sav", @TRUE)
  1634.            Run("notepad.exe", "cmdpost.cpm")
  1635.  
  1636.         The wildcard (*) will cause cmdpost.cpm to be copied as
  1637.         cmdpost.sav.
  1638.  
  1639.  
  1640.         FileDelete (file-list)
  1641.  
  1642.         Deletes files.
  1643.  
  1644.         Example:
  1645.  
  1646.            If FileExist("win.bak") == @TRUE Then FileDelete("win.bak")
  1647.  
  1648.  
  1649.         FileRename (from-list, to-file)
  1650.  
  1651.         Renames files to another set of names.
  1652.  
  1653.  
  1654.         We can illustrate the use of the WinBatch file functions with a
  1655.         typical batch file application.  Our word processor saves a
  1656.         backup copy of each document with a BAK extension, but we want a
  1657.         larger safety net when editing important files.  We want to keep
  1658.         the five most recent versions of the Winbatch manual.  Here is
  1659.         our batch file:
  1660.  
  1661.  
  1662.  
  1663.  
  1664.  
  1665.  
  1666.  
  1667.  
  1668.  
  1669.  
  1670.  
  1671.                                                                        17
  1672.  
  1673.         TUTORIAL
  1674.  
  1675.  
  1676.  
  1677.           If FileExist("winbatch.bak") == @TRUE Then Goto backup
  1678.           :edit
  1679.           Run("winword.exe", "winbatch.doc")
  1680.           Exit
  1681.           :backup
  1682.           FileDelete("winbatch.bk5")
  1683.           FileRename("winbatch.bk4", "winbatch.bk5)
  1684.           FileRename("winbatch.bk3", "winbatch.bk4)
  1685.           FileRename("winbatch.bk2", "winbatch.bk3)
  1686.           FileRename("winbatch.bk1", "winbatch.bk2)
  1687.           FileRename("winbatch.bak", "winbatch.bk1)
  1688.           Goto edit
  1689.  
  1690.         If the file WINBATCH.BAK exists, it means that we have made a
  1691.         change to WINBATCH.DOC.  So, before we start editing, we delete
  1692.         the oldest backup copy, and perform several FileRename functions,
  1693.         until eventually WINBATCH.BAK becomes WINBATCH.BK1.  Notice how
  1694.         the flow of control moves to the line labeled ':backup', and then
  1695.         back to the line labeled ':edit', and how we terminate processing
  1696.         with the Exit statement.  If we did not include the Exit
  1697.         statement, the batch file would continue in an endless loop.
  1698.         However, this batch file still isn't quite right.  What would
  1699.         happen if the file WINBATCH.BK5 didn't exist?  In the DOS batch
  1700.         language, the command would return an error and processing would
  1701.         continue.  But in WinBatch, the error would be fatal, and cause
  1702.         the batch file to abort.
  1703.  
  1704.         There are two ways that we can handle this.  We could use an If
  1705.         FileExist test before every file operation, and test the returned
  1706.         value for a @TRUE before proceeding.  But this would be very
  1707.         clumsy, even with such a small batch file.
  1708.  
  1709.  
  1710.         Handling Errors
  1711.  
  1712.         Luckily, there is a WinBatch system function to help us here:
  1713.         ErrorMode.  The ErrorMode function determines what happens if an
  1714.         error occurs during batch file processing.  Here's the syntax:
  1715.  
  1716.  
  1717.         ErrorMode (mode)
  1718.  
  1719.         Specifies how to handle errors.
  1720.  
  1721.         Parameters:
  1722.           "mode" =  @CANCEL, @NOTIFY, or @OFF.
  1723.  
  1724.         Returns:
  1725.           (integer) previous error setting.
  1726.  
  1727.         Use this command to control the effects of runtime errors.  The
  1728.         default is @CANCEL, meaning the execution of the batch file will
  1729.         be canceled for any error.
  1730.  
  1731.         @CANCEL:  All runtime errors will cause execution to be
  1732.         canceled.  The user will be notified which error occurred.
  1733.  
  1734.  
  1735.  
  1736.  
  1737.         18
  1738.  
  1739.                                                                  TUTORIAL
  1740.  
  1741.  
  1742.  
  1743.         @NOTIFY:  All runtime errors will be reported to the user, and
  1744.         they can choose to continue if it isn't fatal.
  1745.  
  1746.         @OFF:  Minor runtime errors will be suppressed. Moderate and
  1747.         fatal errors will be reported to the user.  User has the option
  1748.         of continuing if the error is not fatal.
  1749.  
  1750.         As you can see, the default mode is @CANCEL, and it's a good idea
  1751.         to leave it like this.  However, it is quite reasonable to change
  1752.         the mode for sections of your batch files where you anticipate
  1753.         errors occurring.  This is just what we've done in our modified
  1754.         batch file:
  1755.  
  1756.           If FileExist("winbatch.bak") == @TRUE Then Goto backup
  1757.           :edit
  1758.           Run("winword.exe", "winbatch.doc")
  1759.           Exit
  1760.           :backup
  1761.           ErrorMode(@OFF)
  1762.           FileDelete("winbatch.bk5")
  1763.           FileRename("winbatch.bk4", "winbatch.bk5)
  1764.           FileRename("winbatch.bk3", "winbatch.bk4)
  1765.           FileRename("winbatch.bk2", "winbatch.bk3)
  1766.           FileRename("winbatch.bk1", "winbatch.bk2)
  1767.           FileRename("winbatch.bak", "winbatch.bk1)
  1768.           ErrorMode(@CANCEL)
  1769.           Goto edit
  1770.  
  1771.         Notice how we've used ErrorMode(@OFF) to prevent errors from
  1772.         aborting the batch file, and then used ErrorMode(@CANCEL) at the
  1773.         end of the backup section to change back to the default mode.
  1774.         This is good practice.
  1775.  
  1776.  
  1777.         Selection Menus
  1778.  
  1779.         So far, whenever we have needed to use a file name, we have hard-
  1780.         coded it into our batch files.  For example:
  1781.  
  1782.           Run("notepad.exe", "agenda.txt")
  1783.  
  1784.         Naturally, there should be a way to get this information from the
  1785.         user "on the fly", so that we wouldn't have to write hundreds of
  1786.         different batch files.  And there is a way.  Two ways, actually.
  1787.         Consider, first, a function that we have already seen, the
  1788.         AskLine function:
  1789.  
  1790.           file = AskLine("", "Enter Filename to edit?", "")
  1791.           Run("notepad.exe", file)
  1792.  
  1793.         This will prompt the user for a filename, and start Notepad using
  1794.         that file.
  1795.  
  1796.         There are only three problems with this approach.  First, the
  1797.         user might not remember the name of the file.  Second, the user
  1798.         might enter the name incorrectly.  And finally, modern software
  1799.  
  1800.  
  1801.  
  1802.  
  1803.                                                                        19
  1804.  
  1805.         TUTORIAL
  1806.  
  1807.  
  1808.  
  1809.         is supposed to be sophisticated enough to handle these things the
  1810.         right way.  And WinBatch certainly can.
  1811.  
  1812.         There are two new functions we need to use for our file selection
  1813.         routine: FileItemize and ItemSelect.
  1814.  
  1815.  
  1816.         FileItemize (file-list)
  1817.  
  1818.         Returns a space-delimited list of files.
  1819.  
  1820.         This function compiles a list of filenames and separates the
  1821.         names with spaces.  There are several variations we can use:
  1822.  
  1823.           FileItemize("*.doc")
  1824.  
  1825.         would give us a list of all files in the current directory with a
  1826.         DOC extension,
  1827.  
  1828.           FileItemize("*.com *.exe")
  1829.  
  1830.         would give us a list of all files in the current directory with a
  1831.         COM or EXE extension, and
  1832.  
  1833.           FileItemize("*.*")
  1834.  
  1835.         would give us a list of all files in the current directory.
  1836.  
  1837.         Of course, we need to be able to use this file list, and for that
  1838.         we use:
  1839.  
  1840.  
  1841.         ItemSelect (title, list, delimiter)
  1842.  
  1843.         Displays a listbox filled with items from a list you specify in a
  1844.         string.  The items are separated in your string by a delimiter
  1845.         character.
  1846.  
  1847.         This function actually displays the list box.  Remember that
  1848.         FileItemize returns a file list delimited by spaces, which would
  1849.         look something like this:
  1850.  
  1851.           file1.doc file2.doc file3.doc
  1852.  
  1853.         When we use ItemSelect, we need to tell it that the delimiter is
  1854.         a space.  We do this as follows:
  1855.  
  1856.            textfiles = FileItemize("*.doc *.txt")
  1857.            yourfile = ItemSelect("Select a file to edit", textfiles, "")
  1858.            run("notepad.exe", yourfile)
  1859.  
  1860.         First, we use FileItemize to build a list of filenames with DOC
  1861.         and TXT extensions.  We assign this list to the variable
  1862.         'textfiles'.  Then, we use the ItemSelect function to build a
  1863.         list box, passing it the variable 'textfiles' as its second
  1864.         parameter.  The third parameter we use for ItemSelect is simply a
  1865.         space with quote marks around it; this tells ItemSelect that the
  1866.         variable 'textfiles' is delimited by spaces.  Note that this is
  1867.         different from the empty string that we've spoken about earlier -
  1868.  
  1869.  
  1870.  
  1871.  
  1872.         20
  1873.  
  1874.                                                                  TUTORIAL
  1875.  
  1876.  
  1877.  
  1878.         - you must include a space between the quote marks.  Finally, we
  1879.         assign the value returned by the ItemSelect function to the
  1880.         variable 'yourfile', and run Notepad using that file.
  1881.  
  1882.         How does ItemSelect get a file name?  As we said, it pops up a
  1883.         list box with all the files returned by the FileSelect function.
  1884.         Then, you highlight a file, using either the cursor keys or a
  1885.         mouse, and select it by pressing Enter, double-clicking on the
  1886.         file, or clicking on the OK button.  If you run the above
  1887.         example, you'll see it more easily than we can explain it in
  1888.         words.
  1889.  
  1890.         If the user presses Enter or clicks on the OK button without a
  1891.         file being highlighted, ItemSelect returns an empty string.  If
  1892.         you want, you can test for this condition:
  1893.  
  1894.            textfiles = FileItemize("*.doc *.txt")
  1895.            :retry
  1896.            yourfile = ItemSelect("Select a file to edit", textfiles, "")
  1897.            if yourfile == "" Then Goto retry
  1898.            run("notepad.exe", yourfile)
  1899.  
  1900.  
  1901.         DirItemize (dir-list)
  1902.  
  1903.         Returns a space-delimited list of directories.
  1904.  
  1905.         This function works like FileItemize, but instead of returning a
  1906.         list of files, it returns a list of directories.  Remember that
  1907.         we said FileItemize only lists files in the current directory.
  1908.         Often, we want to be able to use files in other directories as
  1909.         well.  We can do this by first selecting the appropriate
  1910.         directory, using DirItemize and ItemSelect:
  1911.  
  1912.           DirChange("\")
  1913.           subdirs = DirItemize("*")
  1914.           targdir = ItemSelect("Select dir", subdirs, " ")
  1915.           DirChange(targdir)
  1916.           files = FileItemize("*.*")
  1917.           file = ItemSelect("Select file", files, " ")
  1918.           Run("notepad.exe", file)
  1919.  
  1920.         First we change to the root directory.  Then we use the
  1921.         DirItemize function to get a list of all the subdirectories off
  1922.         of root.  Next, we use ItemSelect to give us a list box of
  1923.         directories to select from.  Finally, we change to the selected
  1924.         directory, and use FileItemize and ItemSelect to pick a file.
  1925.         This batch file works, but needs to be polished up a bit.  What
  1926.         happens if the file we want is in the \WIN\BATCH directory?  Our
  1927.         batch file doesn't go more than one level deep from root.  We
  1928.         want  to continue down the directory tree, but we also need a way
  1929.         of telling when we're at the end of a branch.  As it happens,
  1930.         there is such a way: DirItemize will return an empty string if
  1931.         there are no directories to process.  Given this knowledge, we
  1932.         can set up a loop to test when we are at the lowest level:
  1933.  
  1934.  
  1935.  
  1936.  
  1937.  
  1938.  
  1939.                                                                        21
  1940.  
  1941.         TUTORIAL
  1942.  
  1943.  
  1944.  
  1945.           DirChange("\")
  1946.           :getdir
  1947.           subdirs = DirItemize("*")
  1948.           If subdirs == "" Then Goto getfile
  1949.           targdir = ItemSelect("Select dir (OK for current)", subdirs, "")
  1950.           If targdir == "" Then Goto getfile
  1951.           DirChange(targdir)
  1952.           Goto getdir
  1953.           :getfile
  1954.           files = FileItemize("*.*")
  1955.           file = ItemSelect("Select file", files, " ")
  1956.           if file == "" then goto getfile
  1957.           Run("notepad.exe", file)
  1958.  
  1959.         After we use the DirItemize function, we test the returned value
  1960.         for a blank string.  If we have a blank string, then we know that
  1961.         the current directory has no subdirectories, and so we proceed to
  1962.         select the filename from the current directory (Goto getfile) .
  1963.         If, however, DirItemize returns a non-blank list, then we know
  1964.         that there is, in fact, at least one directory.  In that case, we
  1965.         use ItemSelect to bring up a list box.  Then, we test the value
  1966.         returned by ItemSelect.  If the returned value is a blank string,
  1967.         it means that the user did not select a directory from the list,
  1968.         and presumably wants a file in the current directory.  We happily
  1969.         oblige (Goto getfile).  On the other hand, a non-blank value
  1970.         returned from ItemSelect indicates that the user has selected a
  1971.         subdirectory from the list box.  In that case, we change to the
  1972.         selected directory, and loop back to the beginning of the
  1973.         directory selection routine (Goto getdir).  We continue this
  1974.         until either (a) the user selects a directory, or (b) there are
  1975.         no directories left to select.  Eventually, we get down to the
  1976.         file selection section of the batch file.
  1977.  
  1978.  
  1979.         Nicer Dialog Boxes
  1980.  
  1981.         Have you tried displaying long messages, and found that WinBatch
  1982.         didn't wrap the lines quite the way you wanted?  Here are a
  1983.         couple of tricks.
  1984.  
  1985.  
  1986.         Num2Char (integer)
  1987.  
  1988.         Converts a number to its character equivalent.
  1989.  
  1990.         We want to be able to insert carriage return/line feed
  1991.         combinations in our output, and the Num2Char function will let us
  1992.         do that.  A carriage return has an ASCII value of 13, and a line
  1993.         feed has an ASCII value of 10 (don't worry if you don't
  1994.         understand what that means).  To be able to use these values, we
  1995.         must convert them to characters, as follows:
  1996.  
  1997.           cr = num2char(13)
  1998.           lf = num2char(10)
  1999.  
  2000.  
  2001.  
  2002.  
  2003.  
  2004.  
  2005.         22
  2006.  
  2007.                                                                  TUTORIAL
  2008.  
  2009.  
  2010.  
  2011.         Now, we need to be able to place the variables 'cr' and 'lf' in
  2012.         our message.  For example, let's say we want to do this:
  2013.  
  2014.           Message("", "This is line one This is line two")
  2015.  
  2016.         If we just inserted the variables into the string, as in:
  2017.  
  2018.           Message("", "This is line one cr lf This is line two")
  2019.  
  2020.         we would not get the desired effect (try it and see).  WinBatch
  2021.         would  treat them as ordinary text.  However, WinBatch does
  2022.         provide us with a method of performing variable substitution such
  2023.         as this, and that is by enclosing the variables in percentage
  2024.         signs (%%).  If we do this:
  2025.  
  2026.           Message("", "This is line one %cr% %lf%This is line two")
  2027.  
  2028.         we get what we want.  Note that there is no space after '%lf%';
  2029.         this is so the second line will be aligned with the first line
  2030.         (every space inside the quote marks is significant).
  2031.         Now, wouldn't it be convenient if we could combine cr and lf into
  2032.         a single variable?  We can.
  2033.  
  2034.  
  2035.         StrCat (string[, string]...)
  2036.  
  2037.         Concatenates strings together.
  2038.  
  2039.         The StrCat function lets us combine any number of string
  2040.         constants and/or string variables.  Here's how we combine the
  2041.         variables 'cr' and 'lf' into the single variable 'crlf':
  2042.  
  2043.           crlf = StrCat(cr, lf)
  2044.  
  2045.         Note that the strings to be concatenated are separated by commas,
  2046.         within the parentheses.  Now, we can rewrite our example, as
  2047.         follows:
  2048.  
  2049.           cr = num2char(13)
  2050.           lf = num2char(10)
  2051.           crlf = StrCat(cr, lf)
  2052.           Message("", "This is line one %crlf%This is line two")
  2053.  
  2054.         If we wanted to re-use this message a number of times, it would
  2055.         be quite convenient to use the StrCat function to make a single
  2056.         variable out of it:
  2057.  
  2058.           cr = num2char(13)
  2059.           lf = num2char(10)
  2060.           crlf = StrCat(cr, lf)
  2061.           line1 = "This is line one"
  2062.           line2 = "This is line two"
  2063.           mytext = StrCat(line1, crlf, line2)
  2064.           Message("", mytext)
  2065.  
  2066.  
  2067.  
  2068.  
  2069.  
  2070.  
  2071.  
  2072.  
  2073.                                                                        23
  2074.  
  2075.         TUTORIAL
  2076.  
  2077.  
  2078.  
  2079.  
  2080.         Running DOS Programs
  2081.  
  2082.         WinBatch can run DOS programs, just like it runs Windows
  2083.         programs:
  2084.  
  2085.           dirchange("c:\game")
  2086.           run("scramble.exe", "")
  2087.  
  2088.         If you want to use an internal DOS command, such as DIR or TYPE,
  2089.         you can do so by running the DOS command interpreter,
  2090.         COMMAND.COM, with the '/c' program parameter, as follows:
  2091.  
  2092.           run("command.com", "/c type readme.txt")
  2093.  
  2094.         Everything that you would normally type on the DOS command line
  2095.         goes after the '/c' in the second parameter.  Here's another
  2096.         example:
  2097.  
  2098.           run("command.com", "/c type readme.txt | more")
  2099.  
  2100.         These examples assume that COMMAND.COM is in a directory on your
  2101.         DOS path.  If it isn't, you could specify a full path name for
  2102.         it:
  2103.  
  2104.           run("c:\command.com", "/c type readme.txt | more")
  2105.  
  2106.         Or, better still, you could use the WinBatch Environment
  2107.         function.
  2108.  
  2109.  
  2110.         Environment (env-variable)
  2111.  
  2112.         Gets a DOS environment variable.
  2113.         Since DOS always stores the full path and filename of the command
  2114.         processor in the environmental variable COMSPEC, it is an easy
  2115.         matter to retrieve this information:
  2116.  
  2117.           coms = environment("comspec")
  2118.  
  2119.         and use it in our batch file:
  2120.  
  2121.           coms = environment("comspec")
  2122.           run(coms, "/c type readme.txt")
  2123.  
  2124.         To get a DOS window, just run COMMAND.COM with no parameters:
  2125.  
  2126.           coms = environment("comspec")
  2127.           run(coms, "")
  2128.  
  2129.  
  2130.         Sending Keystrokes to Programs
  2131.  
  2132.         Here we come to one of the most useful and powerful features of
  2133.         WinBatch: the ability to send keystrokes to Windows programs,
  2134.         just as if you were typing them directly from the keyboard.
  2135.  
  2136.  
  2137.         SendKey (character-codes)
  2138.  
  2139.         Sends Keystrokes to the active application.
  2140.  
  2141.  
  2142.  
  2143.  
  2144.  
  2145.         24
  2146.  
  2147.                                                                  TUTORIAL
  2148.  
  2149.  
  2150.  
  2151.         This is an ideal way to automatically program the keys that you
  2152.         enter every time you start a certain program.  For example, to
  2153.         start up Notepad and have it prompt you for a file to open, you
  2154.         would use:
  2155.  
  2156.           Run("notepad.exe", "")
  2157.           SendKey("!FO")
  2158.  
  2159.         The parameter for SendKey is a string to send to the program.
  2160.         This string consists of standard characters, as well as some
  2161.         special characters which you will find listed under the entry for
  2162.         SendKey in the WBL Function Reference (pg. 78).  In the example
  2163.         above, the exclamation mark stands for the Alt key, so '!F' is
  2164.         the equivalent of pressing and holding down the Alt key while
  2165.         simultaneously pressing the 'F' key.  The 'O' in the example
  2166.         above is simply the letter 'O', and is the same as pressing the
  2167.         'O' key.  As you may know, 'Alt-F' brings up the 'File' menu in
  2168.         Notepad, and 'O' selects 'Open' from the 'File' menu.
  2169.         Here's another example:
  2170.  
  2171.           RunZoom("sol.exe", "")
  2172.           SendKey("!GC{RIGHT}{SP}~")
  2173.  
  2174.         This starts up Solitaire, brings up the 'Game' menu (!G), selects
  2175.         'Deck' (C), moves the cursor to the next card back style on the
  2176.         right ({RIGHT}), selects that card back ({SP}), and then selects
  2177.         'OK' (~).  And voila!  A different card design every time you
  2178.         play!
  2179.  
  2180.  
  2181.         Our Completed WinBatch File
  2182.  
  2183.         Here is the final version of the SOLITARE.WBT file that we've
  2184.         been building throughout this tutorial:
  2185.  
  2186.  
  2187.  
  2188.  
  2189.  
  2190.  
  2191.  
  2192.  
  2193.  
  2194.  
  2195.  
  2196.  
  2197.  
  2198.  
  2199.  
  2200.  
  2201.  
  2202.  
  2203.  
  2204.  
  2205.  
  2206.  
  2207.  
  2208.  
  2209.  
  2210.                                                                        25
  2211.  
  2212.         TUTORIAL
  2213.  
  2214.  
  2215.  
  2216.           ; solitare.wbt
  2217.           mins = AskLine("Solitaire", "How many minutes do you want to
  2218.             play?", "")
  2219.           If WinExist("Solitaire") == @TRUE Then Goto activate
  2220.           RunZoom("sol.exe", "")
  2221.           Goto loaded
  2222.           :activate
  2223.           WinActivate("Solitaire")
  2224.           WinZoom("Solitaire")
  2225.           :loaded
  2226.           SendKey("!GC{RIGHT}{SP}~")
  2227.           goal = mins * 60
  2228.           timer = 0
  2229.           :moretime
  2230.           remain = goal - timer
  2231.           WinTitle("Solitaire", "Solitaire (%remain% seconds left)")
  2232.           delay(10)
  2233.           timer = timer + 10
  2234.           If WinExist("Solitaire") == @FALSE Then Exit
  2235.           If timer < goal Then Goto moretime
  2236.           Beep
  2237.           WinClose("Solitaire")
  2238.           Message("Time's up", "Get back to work!")
  2239.  
  2240.         It  incorporates many of the concepts that we've discussed in
  2241.         this tutorial, as well as using some arithmetic (*, -, +) and
  2242.         relational (<) operators that are covered in the following
  2243.         section on the WinBatch language.
  2244.  
  2245.         If you can understand and follow the structures and processes
  2246.         illustrated in this sample file, and can incorporate them into
  2247.         your own WinBatch files, you are well on your way to becoming a
  2248.         WinBatch guru!
  2249.  
  2250.  
  2251.  
  2252.  
  2253.  
  2254.  
  2255.  
  2256.  
  2257.  
  2258.  
  2259.  
  2260.  
  2261.  
  2262.  
  2263.  
  2264.  
  2265.  
  2266.  
  2267.  
  2268.  
  2269.  
  2270.  
  2271.  
  2272.  
  2273.  
  2274.         26
  2275.  
  2276.                                                         WINBATCH LANGUAGE
  2277.  
  2278.  
  2279.  
  2280.  
  2281.                                 WINBATCH LANGUAGE
  2282.  
  2283.  
  2284.  
  2285.  
  2286.         Language Components
  2287.  
  2288.         The statements you write to execute the batch files are
  2289.         constructed from constants, variables, operators, functions,
  2290.         commands, and comments.
  2291.  
  2292.         Constants
  2293.  
  2294.         The programming language supports both integer and string
  2295.         constants.
  2296.  
  2297.         Integer Constants
  2298.  
  2299.         Integer constants are built from the digits 0 through 9.  They
  2300.         can range in magnitude from negative to positive 231 -1
  2301.         (approximately two billion).  Constants larger than these
  2302.         permissible magnitudes will produce unpredictable results.
  2303.  
  2304.         Examples of integer constants:
  2305.  
  2306.                    1
  2307.                  -45
  2308.               377849
  2309.          -1999999999
  2310.  
  2311.         String Constants
  2312.  
  2313.         String constants are comprised of displayable characters bounded
  2314.         by quote marks.  You can use double quotes ("), single quotes
  2315.         ('), or back quotes (`) to enclose a string constant, as long as
  2316.         the same type of quote is used to both start and end it.  If you
  2317.         need to embed the delimiting quote mark inside the string
  2318.         constant, use the delimiting quote mark twice.
  2319.         Examples of string constants:
  2320.  
  2321.           "a"
  2322.           `Betty Boop`
  2323.           "This constant has an embedded "" mark"
  2324.           'This constant also has an embedded " mark'
  2325.  
  2326.         Predefined Constants
  2327.  
  2328.         The programming language has a number of built-in integer
  2329.         constants that can be used for various purposes.  These start
  2330.         with the @-sign, and are case-insensitive (although we prefer to
  2331.         use ALL CAPS).
  2332.  
  2333.         Some predefined constants:
  2334.  
  2335.           @FALSE                            @TILE
  2336.           @NO                               @TRUE
  2337.           @STACK                            @YES
  2338.  
  2339.  
  2340.  
  2341.  
  2342.  
  2343.  
  2344.                                                                        27
  2345.  
  2346.         WINBATCH LANGUAGE
  2347.  
  2348.  
  2349.  
  2350.         A list of all the predefined constants can be found in Appendix
  2351.         A: Predefined Constants.
  2352.  
  2353.         Identifiers
  2354.  
  2355.         Identifiers are the names supplied for variables, functions, and
  2356.         commands in your program.
  2357.         An identifier is a sequence of one or more letters or digits that
  2358.         begins with a letter.  Identifiers may have up to 30 characters.
  2359.  
  2360.         All identifiers are case insensitive.  Upper- and lowercase char-
  2361.         acters may be mixed at will inside variable names, commands or
  2362.         functions.
  2363.  
  2364.         For example these statements all mean the same thing:
  2365.  
  2366.           AskLine(MyTitle, Prompt, Default)
  2367.           ASKLINE(MYTITLE, PROMPT, DEFAULT)
  2368.           aSkLiNe(MyTiTlE, pRoMpT, dEfAuLt)
  2369.  
  2370.         Variables
  2371.  
  2372.         A variable may contain an integer, a string, or a string
  2373.         representing an integer.  Automatic conversions between integers
  2374.         and strings are performed as a matter of course during execution.
  2375.  
  2376.         If a function requires a string parameter and an integer
  2377.         parameter is supplied, the variable will be automatically
  2378.         modified to include the representative string.
  2379.         If a function requires an integer parameter and a string
  2380.         parameter is supplied, an attempt will be made to convert the
  2381.         string to an integer.  If it does not convert successfully, an
  2382.         error will result.
  2383.  
  2384.         Keywords Are Reserved
  2385.  
  2386.         "Keywords" are the predefined identifiers that have special
  2387.         meaning to the programming language.  These cannot be used as
  2388.         variable names.
  2389.  
  2390.         WBL keywords consist of the functions, commands, and predefined
  2391.         constants.
  2392.  
  2393.         Some examples of reserved keywords:
  2394.  
  2395.           beep
  2396.           dirchange
  2397.           @Yes
  2398.           filecopy
  2399.  
  2400.         Operators
  2401.  
  2402.         The programming language operators take one operand ("unary
  2403.         operators") or two operands ("binary operators").
  2404.  
  2405.         Unary operators (integers only):
  2406.  
  2407.           -    Arithmetic Negation (Two's complement)
  2408.  
  2409.  
  2410.  
  2411.  
  2412.         28
  2413.  
  2414.                                                         WINBATCH LANGUAGE
  2415.  
  2416.  
  2417.  
  2418.           +    Identity (Unary plus)
  2419.           ~    Bitwise Not.  Changes each 0 bit to 1, and vice-versa.
  2420.           !    Logical Not.  Produces 0 (@FALSE) if the operand is
  2421.                nonzero, else 1 (@TRUE) if the operand is zero.
  2422.  
  2423.         Binary arithmetic operators (integers only):
  2424.  
  2425.           *    Multiplication
  2426.           /    Division
  2427.           mod  Modulo
  2428.           +    Addition
  2429.           -    Subtraction
  2430.           <<   Left Shift
  2431.           >>   Right Shift
  2432.           &    Bitwise And
  2433.           |    Bitwise Or
  2434.           ^    Bitwise Exclusive Or  (XOR)
  2435.           &&   Logical And
  2436.           | |     Logical Or
  2437.  
  2438.         Binary relational operators (integers and strings):
  2439.  
  2440.           >    Greater-than
  2441.           >=   Greater-than or equal
  2442.           <    Less-than
  2443.           <=   Less-than or equal
  2444.           ==   Equality
  2445.           != or <>Inequality
  2446.  
  2447.         Assignment operator (integers and strings):
  2448.  
  2449.           =    Assigns evaluated result of an expression to a variable
  2450.  
  2451.         Precedence and evaluation order
  2452.  
  2453.         The precedence of the operators affect the evaluation of operands
  2454.         in expressions.  Operands associated with higher-precedence
  2455.         operators are evaluated before the lower-precedence operators.
  2456.  
  2457.         The table below shows the precedence of the operators.  Where
  2458.         operators have the same precedence, they are evaluated from left
  2459.         to right.
  2460.  
  2461.         Operator            Description
  2462.  
  2463.           ( )               Parenthetical grouping
  2464.           ~ ! - +           Unary operators
  2465.           * / mod           Multiplication & Division
  2466.           + -               Addition & Subtraction
  2467.           <<  >>            Shift operators
  2468.           < <= == >= > != <>     Relational operators
  2469.           & ^ |             Bit manipulation operators
  2470.           && | |            Logical operators
  2471.  
  2472.  
  2473.  
  2474.  
  2475.  
  2476.  
  2477.  
  2478.  
  2479.  
  2480.                                                                        29
  2481.  
  2482.         WINBATCH LANGUAGE
  2483.  
  2484.  
  2485.  
  2486.  
  2487.         Comments
  2488.  
  2489.         A comment is a sequence of characters that are ignored when
  2490.         processing a command.  A semicolon (not otherwise part of a
  2491.         string constant) indicates the beginning of a comment.
  2492.  
  2493.         All characters to the right of the semicolon are considered
  2494.         comments and are ignored.
  2495.  
  2496.         Blank lines are also ignored.
  2497.  
  2498.         Examples of comments:
  2499.  
  2500.           ; This is a comment
  2501.           abc = 5 ;This is also a comment
  2502.  
  2503.         Statements
  2504.  
  2505.         Assignment Statements
  2506.  
  2507.         Assignment statements are used to set variables to specific or
  2508.         computed values.  Variables may be set to integers or strings.
  2509.         Examples:
  2510.  
  2511.           a = 5
  2512.           value = Average(a, 10, 15)
  2513.           location = "Northern Hemisphere"
  2514.           World = strcat(location, " ", "Southern Hemisphere")
  2515.  
  2516.         Control Statements
  2517.  
  2518.         Control statements are generally used to execute system
  2519.         management functions and consist of a call to a command without
  2520.         assigning any return values.
  2521.  
  2522.         Examples:
  2523.  
  2524.           run("clock.exe", "")
  2525.           delay(5)
  2526.           winclose("Clock")
  2527.           Exit
  2528.  
  2529.         Substitution
  2530.  
  2531.         The batch language has a powerful substitution feature which
  2532.         inserts the contents of a string variable into a statement before
  2533.         the line is parsed.
  2534.         To substitute the contents of a variable in the statement, simply
  2535.         put a percent-sign (%) on both sides of the variable name.
  2536.  
  2537.         Examples:
  2538.  
  2539.           MyCmd = "DirChange('C:\')"    ;set MyCmd to a command
  2540.           %MyCmd%                ;execute the command
  2541.  
  2542.         ...or consider this one:
  2543.  
  2544.           IniWrite("PC", "Owner", "Jenny")
  2545.           ...
  2546.           Owner = IniRead("PC", "Owner", "somebody")
  2547.           message("", "This is %Owner%'s PC")
  2548.  
  2549.  
  2550.  
  2551.  
  2552.         30
  2553.  
  2554.                                                         WINBATCH LANGUAGE
  2555.  
  2556.  
  2557.  
  2558.  
  2559.         will produce the output:
  2560.  
  2561.           This is Jenny's PC
  2562.  
  2563.         To put a single percent-sign (%) on a source line, specify a
  2564.         double percent sign(%%).  This is required even inside quoted
  2565.         strings.
  2566.  
  2567.         Function Parameters
  2568.  
  2569.         Most of the functions and commands in the language require
  2570.         parameters.  These come in three types:
  2571.  
  2572.           Integer
  2573.           String
  2574.           Variable name
  2575.  
  2576.         WinBatch performs automatic conversions between strings and
  2577.         integers, so in general you can use them interchangeably.
  2578.  
  2579.         Integer parameters may be any of the following:
  2580.  
  2581.           An integer (i.e. 23)
  2582.           A string representing an integer (i.e. "23")
  2583.           A variable containing an integer
  2584.           A variable containing a string representing an integer
  2585.  
  2586.         String parameters may be any of the following:
  2587.  
  2588.           A string
  2589.           An integer
  2590.           A variable containing a string
  2591.           A variable containing an integer
  2592.  
  2593.         Error Handling
  2594.  
  2595.         There are three types of errors that can occur while processing a
  2596.         batch file:  Minor, Moderate, and Fatal.  What happens when an
  2597.         error occurs depends on the current error mode, which is set with
  2598.         the ErrorMode function.
  2599.         There are three possible modes you can specify:
  2600.  
  2601.         @CANCEL
  2602.           User is notified when any error occurs, and then the batch
  2603.           file is canceled.  This is the default.
  2604.  
  2605.         @NOTIFY
  2606.           User is notified when any error occurs, and has option to
  2607.           continue unless the error is fatal.
  2608.  
  2609.         @OFF
  2610.           User is only notified if the error is moderate or fatal.  User
  2611.           has option to continue unless the error is fatal.
  2612.  
  2613.  
  2614.  
  2615.  
  2616.  
  2617.                                                                        31
  2618.  
  2619.         WINBATCH LANGUAGE
  2620.  
  2621.  
  2622.  
  2623.         The function LastError returns the code of the most-recent error
  2624.         encountered during the current batch file.
  2625.  
  2626.         Minor errors are numbered from 1000 to 1999.
  2627.         Moderate errors are numbered from 2000 to 2999.
  2628.         Fatal errors are numbered from 3000 to 3999.
  2629.  
  2630.         Error handling is reset to @CANCEL at the start of each batch
  2631.         file.
  2632.  
  2633.  
  2634.         The Functions & Statements
  2635.  
  2636.  
  2637.         Inputting Information
  2638.  
  2639.         AskLine (title, prompt, default)
  2640.           Lets user enter a line of information.
  2641.  
  2642.         AskYesNo (title, question)
  2643.           Lets user choose from Yes, No, or Cancel.
  2644.  
  2645.         ItemSelect (title, list, delimiter)
  2646.           Chooses an item from a listbox.
  2647.  
  2648.         TextBox (title, filename)
  2649.           Fills a listbox from text strings in a file.
  2650.  
  2651.  
  2652.         Displaying Information
  2653.  
  2654.         Beep
  2655.           Beeps at the user.
  2656.  
  2657.         DialogBox (title, WBD file)
  2658.           Pops up a Windows dialog box defined by the WBD template file.
  2659.  
  2660.         Display (seconds, title, text)
  2661.           Momentarily displays a string.
  2662.  
  2663.         Message (title, text)
  2664.           Displays text in a message box.
  2665.  
  2666.         Pause (title, text)
  2667.           Displays text in a message box.
  2668.  
  2669.  
  2670.         File Management
  2671.  
  2672.         FileClose (filehandle)
  2673.           Closes a file.
  2674.  
  2675.         FileCopy (from-list, to-file, warning)
  2676.           Copies files.
  2677.  
  2678.         FileDelete (file-list)
  2679.           Deletes files.
  2680.  
  2681.         FileExist (filename)
  2682.           Determines if a file exists.
  2683.  
  2684.  
  2685.  
  2686.  
  2687.  
  2688.         32
  2689.  
  2690.                                                         WINBATCH LANGUAGE
  2691.  
  2692.  
  2693.  
  2694.         FileExtension (filename)
  2695.           Returns extension of file.
  2696.  
  2697.         FileItemize (file-list)
  2698.           Builds a list of files.
  2699.  
  2700.         FileLocate (filename)
  2701.           Finds a file within the current DOS path.
  2702.  
  2703.         FileMove (from-list, to-file, warning)
  2704.           Moves files to another set of pathnames.
  2705.  
  2706.         FileOpen (filename, open-type)
  2707.           Opens a STANDARD ASCII (only) file for reading or writing.
  2708.  
  2709.         FilePath (filename)
  2710.           Returns path of file.
  2711.  
  2712.         FileRead (filehandle)
  2713.           Reads data from a file.
  2714.  
  2715.         FileRename (from-list, to-file)
  2716.           Renames files to another set of names.
  2717.  
  2718.         FileRoot (filename)
  2719.           Returns root of file.
  2720.  
  2721.         FileSize (file-list)
  2722.           Adds up the total size of a set of files.
  2723.  
  2724.         FileWrite (filehandle,output-data)
  2725.           Writes data to a file.
  2726.  
  2727.  
  2728.         Directory Management
  2729.  
  2730.         DirChange ([d:]path)
  2731.           Changes the current directory.
  2732.  
  2733.         DirGet ( )
  2734.           Returns the current directory path.
  2735.  
  2736.         DirHome ( )
  2737.           Returns the initial directory path.
  2738.  
  2739.         DirItemize (dir-list)
  2740.           Builds a list of directories.
  2741.  
  2742.         DirMake ([d:]path)
  2743.           Creates a new directory.
  2744.  
  2745.         DirRemove ([d:]path)
  2746.           Removes an existing directory.
  2747.  
  2748.  
  2749.         Disk Drive Management
  2750.  
  2751.         DiskFree (drive-list)
  2752.           Returns the amount of free space on a set of drives.
  2753.  
  2754.         LogDisk (drive)
  2755.           Changes the logged disk drive.
  2756.  
  2757.  
  2758.  
  2759.  
  2760.  
  2761.                                                                        33
  2762.  
  2763.         WINBATCH LANGUAGE
  2764.  
  2765.  
  2766.  
  2767.  
  2768.         Window Management
  2769.  
  2770.         WinActivate (partial-windowname)
  2771.           Makes an application window the active window.
  2772.  
  2773.         WinArrange (style)
  2774.           Arranges all running application windows on the screen.
  2775.  
  2776.         WinClose (partial-windowname)
  2777.           Closes an application window.
  2778.  
  2779.         WinCloseNot (partial-windowname [, partial-windowname]...)
  2780.           Closes all application windows except those specified.
  2781.  
  2782.         WinConfig ( )
  2783.           Returns WIN3 mode flags.
  2784.  
  2785.         WinExist (partialwindowname)
  2786.           Tells if Window exists.
  2787.  
  2788.         WinGetActive ( )
  2789.           Gets the title of the active window.
  2790.  
  2791.         WinHide (partial-windowname)
  2792.           Hides an application window.
  2793.  
  2794.         WinIconize (partial-windowname)
  2795.           Turns an application window into an icon.
  2796.  
  2797.         WinItemize ( )
  2798.           Lists all the main windows currently running.
  2799.  
  2800.         WinPlace (x-ul, y-ul, x-br, y-br, partial-windowname)
  2801.           Changes the size and position of an application window on the
  2802.           screen.
  2803.  
  2804.         WinPosition (partialwindowname)
  2805.           Returns Window position.
  2806.  
  2807.         WinShow (partial-windowname)
  2808.           Shows a currently-hidden application window.
  2809.  
  2810.         WinTitle (partial-windowname, new-windowname)
  2811.           Changes the title of an application window.
  2812.  
  2813.         WinWaitClose (partial-windowname)
  2814.           Waits until an application window is closed.
  2815.  
  2816.         WinZoom (partial-windowname)
  2817.           Maximizes an application window to full-screen.
  2818.  
  2819.  
  2820.         Program Management
  2821.  
  2822.         Run (program-name, parameters)
  2823.           Runs a program as a normal window.
  2824.  
  2825.         RunHide (program-name, parameters)
  2826.           Runs a program in a hidden window.
  2827.  
  2828.         RunIcon (program-name, parameters)
  2829.           Runs a program as an icon.
  2830.  
  2831.  
  2832.  
  2833.  
  2834.  
  2835.         34
  2836.  
  2837.                                                         WINBATCH LANGUAGE
  2838.  
  2839.  
  2840.  
  2841.         RunZoom (program-name, parameters)
  2842.           Runs a program in a maximized window.
  2843.  
  2844.  
  2845.         String Handling
  2846.  
  2847.         Char2Num (string)
  2848.           Returns the ANSI code of a string's first character.
  2849.  
  2850.         IsNumber (string)
  2851.           Determines if a string represents a valid number.
  2852.  
  2853.         Num2Char (number)
  2854.           Converts a number to the ANSI character it represents.
  2855.  
  2856.         ParseData (string)
  2857.           Parses the passed string, just like passed parameters are
  2858.           parsed.
  2859.  
  2860.         StrCat (string[, string]...)
  2861.           Concatenates strings together.
  2862.  
  2863.         StrCmp (string1, string2)
  2864.           Compares two strings.
  2865.  
  2866.         StrFill (string, string-length)
  2867.           Builds a string from a repeated smaller string.
  2868.  
  2869.         StrFix (base-string, padding-string, length)
  2870.           Pads or truncates a string to a fixed length.
  2871.  
  2872.         StrICmp (string1, string2)
  2873.           Compares two strings, ignoring their case.
  2874.  
  2875.         StrIndex (main-str, sub-str, start, direction)
  2876.           Locates a string within a larger string.
  2877.  
  2878.         StrLen (string)
  2879.           Returns the length of a string
  2880.         StrLower (string)
  2881.           Converts a string to all lower-case characters.
  2882.  
  2883.         StrReplace (string,old,new)
  2884.           Replaces all occurrences of a substring with another.
  2885.  
  2886.         StrScan (main-str, delims, start, direction)
  2887.           Finds an occurrence of one or more delimiter characters in a
  2888.           string.
  2889.  
  2890.         StrSub (string, start, length)
  2891.           Returns a substring from within a string.
  2892.  
  2893.         StrTrim (string)
  2894.           Trims leading and trailing blanks from a string.
  2895.  
  2896.         StrUpper (string)
  2897.           Converts a string to all upper-case characters.
  2898.  
  2899.  
  2900.  
  2901.  
  2902.  
  2903.  
  2904.  
  2905.  
  2906.                                                                        35
  2907.  
  2908.         WINBATCH LANGUAGE
  2909.  
  2910.  
  2911.  
  2912.  
  2913.         Arithmetic Functions
  2914.  
  2915.         Abs (number)
  2916.           Returns the absolute value of a number.
  2917.  
  2918.         Average (num [, num]...)
  2919.           Returns the average of a list of integers.
  2920.  
  2921.         Max (num [, num]...)
  2922.           Determines the highest number in a list.
  2923.  
  2924.         Min (num [, num]...)
  2925.           Determines the lowest number in a list.
  2926.  
  2927.         Random (max)
  2928.           Generates a positive random number.
  2929.  
  2930.  
  2931.         Clipboard Handling
  2932.  
  2933.         ClipAppend (string)
  2934.           Appends a string to the end of the Clipboard.
  2935.  
  2936.         ClipGet ( )
  2937.           Returns the Clipboard contents into a string.
  2938.  
  2939.         ClipPut (string)
  2940.           Replaces the Clipboard contents with a string.
  2941.  
  2942.  
  2943.         System Control
  2944.  
  2945.         Call (filename.wbt, parameters)
  2946.           Calls another WBT file as a subroutine.
  2947.  
  2948.         CallExt (filename.wbt, parameters)
  2949.           Calls another WBT file as a separate subprogram.
  2950.  
  2951.         DateTime ( )
  2952.           Returns the current date and time.
  2953.  
  2954.         Debug (mode)
  2955.           Turns Debug mode on or off.
  2956.  
  2957.         Delay (seconds)
  2958.           Pauses batch file execution.
  2959.  
  2960.         DOSVersion (level)
  2961.           Returns the version numbers of the current version of DOS.
  2962.  
  2963.         Drop (var [, var]...)
  2964.           Deletes variables to recover their memory.
  2965.  
  2966.         EndSession ( )
  2967.           Ends the current Windows session.
  2968.  
  2969.         Environment (env-variable)
  2970.           Returns the value of a DOS environment variable.
  2971.  
  2972.         ErrorMode (mode)
  2973.           Sets what happens in the event of an error.
  2974.  
  2975.  
  2976.  
  2977.  
  2978.  
  2979.         36
  2980.  
  2981.                                                         WINBATCH LANGUAGE
  2982.  
  2983.  
  2984.  
  2985.         Exclusive (mode)
  2986.           Controls whether or not other Windows program will get any
  2987.           time to execute.
  2988.  
  2989.         Execute statement
  2990.           Directly executes a WinBatch statement.
  2991.  
  2992.         Exit
  2993.           Exits the current batch file's operation.
  2994.  
  2995.         Goto label
  2996.           Changes the flow of control in a batch file.
  2997.  
  2998.         If ... Then
  2999.           Conditionally performs a function.
  3000.  
  3001.         IgnoreInput (mode)
  3002.           Turns off hardware input to windows.
  3003.  
  3004.         IniRead (section, keyname, default)
  3005.           Reads a string from the win.ini file.
  3006.  
  3007.         IniReadPvt (section, keyname, default, filename)
  3008.           For reading private ini files.
  3009.  
  3010.         IniWrite (section, keyname, string)
  3011.           Writes a string to the win.ini file.
  3012.  
  3013.         IniWritePvt (section, keyname, data, filename)
  3014.           For writing private ini files.
  3015.  
  3016.         IsDefined (variable)
  3017.           Determines if a variable is currently defined.
  3018.  
  3019.         IsKeyDown (key-codes)
  3020.           Tells about keys/mouse.
  3021.  
  3022.         IsLicensed ( )
  3023.           Tells if WinBatch is licensed.
  3024.  
  3025.         LastError ( )
  3026.           Returns the last error encountered.
  3027.  
  3028.         Return ( )
  3029.           Used to return from a Call or a CallExt to the calling
  3030.           program.
  3031.  
  3032.         SendKey (character-codes)
  3033.           Sends Keystrokes to the active application.
  3034.  
  3035.         SKDebug (mode)
  3036.           Controls how SendKey works
  3037.  
  3038.         Version ( )
  3039.           Returns the version of WinBatch currently running.
  3040.  
  3041.         WinVersion (level)
  3042.           Gets the version of Windows that is currently running.
  3043.  
  3044.         Yield
  3045.           Pauses batch file processing so other applications can process
  3046.           some messages.
  3047.  
  3048.  
  3049.  
  3050.  
  3051.  
  3052.                                                                        37
  3053.  
  3054.                                                    WBL FUNCTION REFERENCE
  3055.  
  3056.  
  3057.  
  3058.  
  3059.                              WBL FUNCTION REFERENCE
  3060.  
  3061.  
  3062.  
  3063.  
  3064.         Introduction
  3065.  
  3066.         WinBatch gives you almost a hundred functions and control
  3067.         statements, which we describe in detail in this section.
  3068.         We use a shorthand notation to indicate the syntax of the
  3069.         functions.
  3070.  
  3071.         Function names and other actual characters you type are in
  3072.         boldface.  Optional parameters are enclosed in square brackets "[
  3073.         ]".  When a function takes a variable number of parameters, the
  3074.         variable parts will be followed by ellipses ("...").
  3075.  
  3076.         Take for example string concatenation:
  3077.  
  3078.         StrCat (string[, string]...)
  3079.  
  3080.         This says that the StrCat function takes at least one string
  3081.         parameter.  Optionally you can specify more strings to
  3082.         concatenate.  If you do, you must separate the strings with
  3083.         commas.
  3084.  
  3085.         For each function and control statement, we show you the Syntax,
  3086.         describe the Parameters (if any), the value it Returns (if any),
  3087.         a description of the function, any nonfatal Errors specific to
  3088.         the function, Example code (shown in courier type), and related
  3089.         functions you may want to See Also.
  3090.  
  3091.  
  3092.  
  3093.  
  3094.  
  3095.  
  3096.  
  3097.  
  3098.  
  3099.  
  3100.  
  3101.  
  3102.  
  3103.  
  3104.  
  3105.  
  3106.  
  3107.  
  3108.  
  3109.  
  3110.  
  3111.  
  3112.  
  3113.  
  3114.  
  3115.  
  3116.  
  3117.  
  3118.  
  3119.                                                                        39
  3120.  
  3121.         WBL FUNCTION REFERENCE
  3122.  
  3123.  
  3124.  
  3125.  
  3126.  
  3127.  
  3128.         Abs
  3129.  
  3130.         Returns the magnitude of the argument.
  3131.  
  3132.         Syntax:
  3133.           Abs (integer)
  3134.  
  3135.         Parameters:
  3136.           integer = integer whose absolute value is desired.
  3137.  
  3138.         Returns:
  3139.           (integer) absolute value of argument.
  3140.  
  3141.         Example:
  3142.           DY = abs(y1 - y2)
  3143.           Message("Years", "There are %DY% years 'twixt %y1% and %y2%")
  3144.  
  3145.         See Also:
  3146.           Average, Max, Min
  3147.  
  3148.  
  3149.  
  3150.         AskLine
  3151.  
  3152.         Prompts the user for one line of input.
  3153.  
  3154.         Syntax:
  3155.           AskLine (title, prompt, default)
  3156.  
  3157.         Parameters:
  3158.           "title" = title of the dialog box.
  3159.           "prompt" =   question to be put to the user.
  3160.           "default" =  default answer.
  3161.  
  3162.         Returns:
  3163.           (string)  user response.
  3164.  
  3165.         Use this command to query the user for a line of data.  The
  3166.         entire user response will be returned if the user presses the OK
  3167.         button or the Enter key.  If they press Cancel, the batch file
  3168.         processing is canceled.
  3169.  
  3170.         Example:
  3171.           Name = AskLine("Dessert", "Please enter your name", "")
  3172.           Dsrt = AskLine("Dessert", "Favorite dessert?", "Ice Cream")
  3173.           message(strcat(Name,"'s dessert is "), Dsrt)
  3174.  
  3175.         See Also:
  3176.           AskYesNo, Display, ItemSelect, Message, Pause, TextBox
  3177.  
  3178.  
  3179.  
  3180.  
  3181.  
  3182.  
  3183.  
  3184.  
  3185.         40
  3186.  
  3187.                                                    WBL FUNCTION REFERENCE
  3188.  
  3189.  
  3190.  
  3191.         AskYesNo
  3192.  
  3193.         Prompts the user for a YES or NO answer.
  3194.  
  3195.         Syntax:
  3196.           AskYesNo (title, question)
  3197.  
  3198.         Parameters
  3199.           "title" = title of the question box.
  3200.           "question" = question to be put to the user.
  3201.  
  3202.         Returns:
  3203.           (integer) @YES or @NO, depending on the button pressed.
  3204.  
  3205.         This command displays a message box with three pushbuttons - Yes,
  3206.         No, and Cancel.  If the user presses Cancel, the current batch
  3207.         file is ended so there is no return value.
  3208.  
  3209.         Example:
  3210.           q = AskYesNo('Testing', 'Please press "YES"')
  3211.           If q == @YES Then Exit
  3212.           Display(3, 'ERROR', 'I said press "YES"')
  3213.  
  3214.         See Also:
  3215.           AskLine, Display, ItemSelect, Message, Pause, TextBox
  3216.  
  3217.  
  3218.  
  3219.         Average
  3220.  
  3221.         Provides the integer average of the arguments.
  3222.  
  3223.         Syntax:
  3224.           Average (integer [, integer]...)
  3225.  
  3226.         Parameters:
  3227.           integer = integers to get the average of.
  3228.  
  3229.         Returns:
  3230.           (integer) average of the arguments.
  3231.  
  3232.         Use this command to compute the average of a series of numbers.
  3233.         This function returns an integer value, so there can be some
  3234.         rounding error involved.
  3235.  
  3236.         Errors:
  3237.           2060 "Average function syntax error"
  3238.  
  3239.         Example:
  3240.           Ave = Average(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12)
  3241.           Message("The average is", Ave)
  3242.  
  3243.         See Also:
  3244.           Abs, Max, Min
  3245.  
  3246.  
  3247.  
  3248.  
  3249.  
  3250.  
  3251.  
  3252.                                                                        41
  3253.  
  3254.         WBL FUNCTION REFERENCE
  3255.  
  3256.  
  3257.  
  3258.         Beep
  3259.  
  3260.         Beeps once.
  3261.  
  3262.         Syntax:
  3263.           Beep
  3264.  
  3265.         Use this command to produce a short beep, generally to alert the
  3266.         user to an error situation.
  3267.  
  3268.         Example:
  3269.           Beep
  3270.           Pause("WARNING!!!", "You are about to destroy data!")
  3271.  
  3272.  
  3273.  
  3274.         Call
  3275.  
  3276.         Calls another WBT file as a subroutine.
  3277.  
  3278.         Syntax:
  3279.           Call (filename.wbt, parameters)
  3280.  
  3281.         Parameters:
  3282.           "filename.wbt" =  the WBT file you are calling.  The extension
  3283.                     is required.
  3284.           "parameters" = the parameters to pass to the file, if any, in
  3285.                     the form "p1 p2 p3  ... pn".
  3286.  
  3287.         Returns:
  3288.           (integer) always @FALSE.
  3289.  
  3290.         Can pass parameters.  All variables are common (global) between
  3291.         the calling and the callee WBT file.
  3292.  
  3293.         Example:
  3294.           Call("chk-nam.wbt", "Susie")
  3295.  
  3296.         See Also:
  3297.           CallExt
  3298.  
  3299.  
  3300.  
  3301.         CallExt
  3302.  
  3303.         Calls another WBT file as a separate subprogram.
  3304.  
  3305.         Syntax:
  3306.           Callext (filename.wbt, parameters)
  3307.  
  3308.         Parameters:
  3309.           "filename.wbt" =  the WBT file you are calling.  The extension
  3310.                     is required.
  3311.           "parameters" = the parameters to pass to the file, if any, in
  3312.                     the form "p1 p2 p3  ... pn".
  3313.  
  3314.  
  3315.  
  3316.  
  3317.  
  3318.  
  3319.         42
  3320.  
  3321.                                                    WBL FUNCTION REFERENCE
  3322.  
  3323.  
  3324.  
  3325.         Returns:
  3326.           (integer) always @FALSE.
  3327.  
  3328.         Can pass parameters to the file.  No return value possible.  All
  3329.         variables are different.
  3330.  
  3331.         Example:
  3332.           CallExt("Chk-Num.wbt", "987 234 929")
  3333.  
  3334.         See Also:
  3335.           Call
  3336.  
  3337.  
  3338.  
  3339.         Char2Num
  3340.  
  3341.         Converts the first character of a string to its numeric
  3342.         equivalent.
  3343.  
  3344.         Syntax:
  3345.           Char2Num (string)
  3346.  
  3347.         Parameters:
  3348.           "string" =   any text string.  Only the first character will be
  3349.                     converted.
  3350.  
  3351.         Returns:
  3352.           (integer) ANSI character code.
  3353.  
  3354.         This function returns the 8-bit ANSI code corresponding to the
  3355.         first character of the string parameter.
  3356.  
  3357.         Note:  For the commonly-used characters (with codes below 128),
  3358.         ANSI and ASCII characters are identical.
  3359.  
  3360.         Example:
  3361.           ; Show the hex equivalent of entered character
  3362.           InpChar = AskLine("ANSI Equivalents", "Char:", "")
  3363.           Ansi = strsub(InpChar, 1, 1)
  3364.           AnsiEquiv = Char2Num(InpChar)
  3365.           Message("ANSI Codes", "%Ansi% => %AnsiEquiv%")
  3366.  
  3367.         See Also:
  3368.           Num2Char
  3369.  
  3370.  
  3371.  
  3372.         ClipAppend
  3373.  
  3374.         Appends a string to the Clipboard.
  3375.  
  3376.         Syntax:
  3377.           ClipAppend (string)
  3378.  
  3379.         Parameters:
  3380.           "string" =   text string to add to Clipboard.
  3381.  
  3382.  
  3383.  
  3384.  
  3385.                                                                        43
  3386.  
  3387.         WBL FUNCTION REFERENCE
  3388.  
  3389.  
  3390.  
  3391.         Returns:
  3392.           (integer) @TRUE if string was appended;
  3393.                     @FALSE if Clipboard ran out of memory.
  3394.  
  3395.         Use this command to append a string to the Windows Clipboard.
  3396.         The Clipboard must either contain text data or be empty for this
  3397.         command to succeed.
  3398.  
  3399.         Example:
  3400.           ; The code below will append 2 copies of the
  3401.           ; Clipboard contents back to the Clipboard, resulting
  3402.           ; in 3 copies of the original contents with a CR/LF
  3403.           ; between each copy.
  3404.           a = clipget()
  3405.           crlf = strcat(num2char(13), num2char(10))
  3406.           clipappend(crlf)
  3407.           clipappend(a)
  3408.           clipappend(crlf)
  3409.           clipappend(a)
  3410.  
  3411.         See Also:
  3412.           ClipGet, ClipPut
  3413.  
  3414.  
  3415.  
  3416.         ClipGet
  3417.  
  3418.         Returns the contents of the Clipboard.
  3419.  
  3420.         Syntax:
  3421.           ClipGet ( )
  3422.  
  3423.         Returns:
  3424.           (string)  clipboard contents.
  3425.  
  3426.         Use this command to copy text from the Windows Clipboard into a
  3427.         string variable.
  3428.  
  3429.         Note:  If the Clipboard contains an excessively large string a
  3430.         (fatal) out of memory error may occur.
  3431.  
  3432.         Example:
  3433.           ; The code below will convert Clipboard contents to
  3434.           ; uppercase
  3435.           clipput(strupper(clipget()))
  3436.           a = clipget()
  3437.           message("UPPERCASE Clipboard Contents", a)
  3438.  
  3439.         See Also:
  3440.           ClipAppend, ClipPut
  3441.  
  3442.  
  3443.  
  3444.  
  3445.  
  3446.  
  3447.  
  3448.  
  3449.  
  3450.         44
  3451.  
  3452.                                                    WBL FUNCTION REFERENCE
  3453.  
  3454.  
  3455.  
  3456.         ClipPut
  3457.  
  3458.         Copies a string to the clipboard.
  3459.  
  3460.         Syntax:
  3461.           ClipPut (string)
  3462.  
  3463.         Parameters:
  3464.           "string" =   any text string.
  3465.  
  3466.         Returns:
  3467.           (integer) @TRUE if string was copied;
  3468.                     @FALSE if clipboard ran out of memory.
  3469.  
  3470.         Use this command to copy a string to the Windows Clipboard.  The
  3471.         previous Clipboard contents will be lost.
  3472.  
  3473.         Example:
  3474.           ; The code below will convert Clipboard contents to
  3475.           ; lowercase
  3476.           clipput(strlower(clipget()))
  3477.           a = clipget ()
  3478.           message("lowercase Clipboard Contents", a)
  3479.  
  3480.         See Also:
  3481.           ClipAppend, ClipGet
  3482.  
  3483.  
  3484.  
  3485.         DateTime
  3486.  
  3487.         Provides the current Date and time.
  3488.  
  3489.         Syntax:
  3490.           DateTime ( )
  3491.  
  3492.         Returns:
  3493.           (string)  Today's Date and time
  3494.  
  3495.         This function will return the current date and time in a pre-
  3496.         formatted string.  The format it is returned in depends on how it
  3497.         is set up in the international section of the WIN.INI file:
  3498.         ddd mm:dd:yy hh:mm:ss XX
  3499.         ddd dd:mm:yy hh:mm:ss XX
  3500.         ddd yy:mm:dd hh:mm:ss XX
  3501.  
  3502.         Where
  3503.           ddd is day of the week (e.g. Mon)
  3504.           mm  is the month (e.g. 10)
  3505.           dd  is the day of the month (e.g. 23)
  3506.           yy  is the year (e.g. 90)
  3507.           hh  is the hours
  3508.           mm  is the minutes
  3509.           ss  is the seconds
  3510.           XX  is the Day/Night code (e.g. AM or PM)
  3511.  
  3512.         Note:  Windows provides even more formatting options than this.
  3513.  
  3514.  
  3515.  
  3516.  
  3517.                                                                        45
  3518.  
  3519.         WBL FUNCTION REFERENCE
  3520.  
  3521.  
  3522.  
  3523.         The WIN.INI file will be examined to determine which format to
  3524.         use.  You can adjust the WIN.INI file via the International
  3525.         section of the Control Panel if the format isn't what you prefer.
  3526.  
  3527.         Example:
  3528.           ; assuming the current standard is U.S.
  3529.           ; (i.e. day  dd/mm/yy hh:mm:ss AM):
  3530.           Message("Current Date & Time", DateTime())
  3531.  
  3532.  
  3533.  
  3534.         Debug
  3535.  
  3536.         Controls the debug mode.
  3537.  
  3538.         Syntax:
  3539.           Debug (mode)
  3540.  
  3541.         Parameters:
  3542.           mode =    @ON or @OFF
  3543.  
  3544.         Returns:
  3545.           (integer) Previous Debug mode
  3546.  
  3547.         Use this command to turn the debug mode on or off.  The default
  3548.         is @OFF.
  3549.  
  3550.         When Debug mode is on, WinBatch will display the command just
  3551.         executed, its result (if any), any error conditions, and the next
  3552.         command to execute.
  3553.  
  3554.         The commands are displayed in a special dialog box.  As you can
  3555.         see in the Example section following, the dialog box gives the
  3556.         user four options:  Next, Run, Cancel and Show Var.
  3557.         Next executes the next statement and remains in debug mode.
  3558.  
  3559.         Run exits debug mode and runs the rest of the program normally.
  3560.         Cancel terminates the current batch file.
  3561.  
  3562.         Show Var displays the contents of a variable whose name the user
  3563.         entered in the edit box.
  3564.  
  3565.         Example:
  3566.           ; Debug example
  3567.           Debug(@ON)
  3568.           a = 6
  3569.           q = AskYesNo("Testing Debug Mode", "Is the Pope Catholic")
  3570.           Debug(@OFF)
  3571.           b = a + 4
  3572.  
  3573.         See Also:
  3574.           ErrorMode, LastError
  3575.  
  3576.  
  3577.  
  3578.  
  3579.  
  3580.  
  3581.  
  3582.  
  3583.  
  3584.         46
  3585.  
  3586.                                                    WBL FUNCTION REFERENCE
  3587.  
  3588.  
  3589.  
  3590.         Delay
  3591.  
  3592.         Pauses execution a specified amount of time.
  3593.  
  3594.         Syntax:
  3595.           Delay (seconds)
  3596.  
  3597.         Parameters:
  3598.           seconds = number of seconds to delay (2 - 15)
  3599.  
  3600.         Returns:
  3601.           (integer) always @TRUE
  3602.  
  3603.         Seconds must be between 2 and 15. Smaller or larger numbers will
  3604.         be adjusted accordingly.
  3605.  
  3606.         Example:
  3607.           Message("Wait", "About 15 seconds")
  3608.           Delay(15)
  3609.           Message("Hi", "I'm Baaaaaaack")
  3610.  
  3611.         See Also:
  3612.           Yield
  3613.  
  3614.  
  3615.  
  3616.         DialogBox
  3617.  
  3618.         Pops up a Windows dialog box defined by the WBD template file.
  3619.  
  3620.         Syntax:
  3621.           DialogBox ("title", "WBD file")
  3622.  
  3623.         Parameters:
  3624.           "title" = the title of the dialog box.
  3625.           "WBD file" = the name of the WBD template file.
  3626.  
  3627.  
  3628.  
  3629.         DirChange
  3630.  
  3631.         Changes the current directory.  Can also log a new drive.
  3632.  
  3633.         Syntax:
  3634.           DirChange ([d:]path)
  3635.  
  3636.         Parameters:
  3637.           "[d:]" =  an optional disk drive to log onto.
  3638.           "path" =  the desired path.
  3639.  
  3640.         Returns:
  3641.           (integer) @TRUE if directory was changed;
  3642.                     @FALSE if the path could not be found.
  3643.  
  3644.         Use this command to change the current working directory to
  3645.         another directory, either on the same or a different disk drive.
  3646.  
  3647.  
  3648.  
  3649.  
  3650.  
  3651.  
  3652.  
  3653.                                                                        47
  3654.  
  3655.         WBL FUNCTION REFERENCE
  3656.  
  3657.  
  3658.  
  3659.         Errors:
  3660.           1031 "DirChange: Dir not found/changed"
  3661.  
  3662.         Example:
  3663.           DirChange("c:\")
  3664.           textbox("This is your CONFIG.SYS file", "config.sys")
  3665.  
  3666.         See Also:
  3667.           DirGet, DirHome, LogDisk
  3668.  
  3669.  
  3670.  
  3671.         DirGet
  3672.  
  3673.         Gets the Current Working Directory.
  3674.  
  3675.         Syntax:
  3676.           DirGet ( )
  3677.  
  3678.         Returns:
  3679.           (string) =   Current Working Directory.
  3680.  
  3681.         Use this command to determine which directory we are currently
  3682.         in.  It's especially useful when changing drives or directories
  3683.         temporarily.
  3684.  
  3685.         Example:
  3686.           ; Get, then restore current working directory
  3687.           OrigDir = DirGet()
  3688.           DirChange("c:\")
  3689.           FileCopy("config.sys", "%OrigDir%xxxtemp.xyz", @FALSE)
  3690.           DirChange(OrigDir)
  3691.  
  3692.         See Also:
  3693.           DirHome
  3694.  
  3695.  
  3696.  
  3697.         DirHome
  3698.  
  3699.         Returns directory containing the WinBatch executable files.
  3700.  
  3701.         Syntax:
  3702.           DirHome ( )
  3703.  
  3704.         Returns:
  3705.           (string)  pathname of the home directory.
  3706.  
  3707.         Use this command to determine the location of WINBATCH.EXE.
  3708.  
  3709.         Example:
  3710.           a = DirHome()
  3711.           Message("WinBatch Executable is in ", a)
  3712.  
  3713.  
  3714.  
  3715.  
  3716.  
  3717.  
  3718.  
  3719.         48
  3720.  
  3721.                                                    WBL FUNCTION REFERENCE
  3722.  
  3723.  
  3724.  
  3725.         See Also:
  3726.           DirGet
  3727.  
  3728.  
  3729.  
  3730.         DirItemize
  3731.  
  3732.         Returns a space-delimited list of directories.
  3733.  
  3734.         Syntax:
  3735.           DirItemize (dir-list)
  3736.  
  3737.         Parameters:
  3738.           "dir-list" = a string containing a set of subdirectory names,
  3739.                     which may be wildcarded.
  3740.         Returns:
  3741.           (string)  list of directories.
  3742.  
  3743.         This function compiles a list of subdirectories and separates the
  3744.         names with spaces.
  3745.  
  3746.         This is especially useful in conjunction with the ItemSelect
  3747.         function, which enables the user to choose an item from such a
  3748.         space-delimited list.
  3749.         DirItemize("*.*") returns all dirs
  3750.  
  3751.         Example:
  3752.           ;Verify directory selection:
  3753.           a = DirItemize("")
  3754.           ItemSelect("Directories", a, " ")
  3755.  
  3756.         See Also:
  3757.           FileItemize, WinItemize, ItemSelect
  3758.  
  3759.  
  3760.  
  3761.         DirMake
  3762.  
  3763.         Creates a new directory.
  3764.  
  3765.         Syntax:
  3766.           DirMake ([d:]path)
  3767.  
  3768.         Parameters:
  3769.           "[d:]" =  the desired disk drive.
  3770.           "path" =  the path to create.
  3771.  
  3772.         Returns:
  3773.           (integer) @TRUE if the directory was successfully created;
  3774.                     @FALSE if it wasn't.
  3775.  
  3776.         Use this command to create a new directory.
  3777.  
  3778.  
  3779.  
  3780.  
  3781.  
  3782.  
  3783.  
  3784.  
  3785.                                                                        49
  3786.  
  3787.         WBL FUNCTION REFERENCE
  3788.  
  3789.  
  3790.  
  3791.         Errors:
  3792.           1029 "DirMake: Dir not created"
  3793.  
  3794.         Example:
  3795.           DirMake("c:\XXXSTUFF")
  3796.  
  3797.         See Also:
  3798.           DirRemove
  3799.  
  3800.  
  3801.  
  3802.         DirRemove
  3803.  
  3804.         Removes a directory.
  3805.  
  3806.         Syntax:
  3807.           DirRemove (dir-list)
  3808.  
  3809.         Parameters:
  3810.           "dir-list" = a space-delimited list of directory pathnames.
  3811.  
  3812.         Returns:
  3813.           (integer) @TRUE if the directory was successfully removed;
  3814.                     @FALSE if it wasn't.
  3815.  
  3816.         Use this command to delete directories.  You can delete one or
  3817.         more at a time by separating directory names with spaces.  You
  3818.         cannot, however, use wildcards.
  3819.  
  3820.         Errors:
  3821.           1030 "DirRemove: Dir not removed"
  3822.  
  3823.         Examples:
  3824.           DirRemove("c:\XXXSTUFF")
  3825.           DirRemove("tempdir1 tempdir2 tempdir3")
  3826.  
  3827.         See Also:
  3828.           DirMake
  3829.  
  3830.  
  3831.  
  3832.         DiskFree
  3833.  
  3834.         Finds the total space available on a group of drives.
  3835.  
  3836.         Syntax:
  3837.           DiskFree (drive-list)
  3838.  
  3839.         Parameters:
  3840.           "drive-list" = at least one drive letter, separated by spaces.
  3841.  
  3842.         Returns:
  3843.           (integer) the number of bytes available on all the specified
  3844.                     drives.
  3845.  
  3846.         This function takes a string consisting of drive letters,
  3847.         separated by spaces.  Only the first character of each non-blank
  3848.  
  3849.  
  3850.  
  3851.  
  3852.         50
  3853.  
  3854.                                                    WBL FUNCTION REFERENCE
  3855.  
  3856.  
  3857.  
  3858.         group of characters is used to determine the drives, so you can
  3859.         use just the drive letters, or add a colon (":"), or add a
  3860.         backslash ("\"), or even a whole pathname and still get a
  3861.         perfectly valid result.
  3862.  
  3863.         Example:
  3864.           Size = DiskFree("c d")
  3865.           Message("Space Available on C: & D:", Size)
  3866.  
  3867.         See Also:
  3868.           FileSize
  3869.  
  3870.  
  3871.  
  3872.         Display
  3873.  
  3874.         Displays a message to the user for a specified time.
  3875.  
  3876.         Syntax:
  3877.           Display (seconds, title, text)
  3878.  
  3879.         Parameters:
  3880.           seconds = integer seconds to display the message (1-15).
  3881.           "title" = Title of the window to be displayed.
  3882.           "text" =  Text of the window to be displayed.
  3883.  
  3884.         Returns:
  3885.           (integer) always @TRUE.
  3886.  
  3887.         Seconds must be between 1 and 15.  Smaller or larger numbers will
  3888.         be adjusted accordingly.
  3889.         Use this command to display a message for a few seconds, and then
  3890.         continue with processing without user input.
  3891.  
  3892.         The display box may be prematurely canceled by the user by
  3893.         clicking it with a mouse, or hitting any character.
  3894.  
  3895.         Example:
  3896.           name = askline("Desserts", "Please enter your name", "")
  3897.           dsrt = askline("Desserts", "Favorite dessert?", "Ice Cream")
  3898.           display(3, "%name%'s Dessert", dsrt)
  3899.  
  3900.         See Also:
  3901.           Pause, Message
  3902.  
  3903.  
  3904.  
  3905.         DOSVersion
  3906.  
  3907.         Returns the version numbers of the current version of DOS.
  3908.  
  3909.         Syntax:
  3910.           DOSVersion (level)
  3911.  
  3912.         Parameters:
  3913.           level =   @MAJOR or @MINOR.
  3914.  
  3915.  
  3916.  
  3917.  
  3918.                                                                        51
  3919.  
  3920.         WBL FUNCTION REFERENCE
  3921.  
  3922.  
  3923.  
  3924.  
  3925.         @MAJOR returns the integer part (to the left of the decimal).
  3926.         @MINOR returns the decimal part (to the right of the decimal).
  3927.  
  3928.         Example:
  3929.           r = DOSVersion(@MAJOR)
  3930.           v = DOSVersion(@MINOR)
  3931.           Message("DOS Version", "%r%.%v%")
  3932.  
  3933.  
  3934.  
  3935.         Drop
  3936.  
  3937.         Removes variables from memory.
  3938.  
  3939.         Syntax:
  3940.           Drop (var, [var]...)
  3941.  
  3942.         Parameters:
  3943.           var =     variable names to remove.
  3944.  
  3945.         Returns:
  3946.           (integer) @TRUE.
  3947.  
  3948.         This function removes variables from the language processor's
  3949.         variable list, and recovers the memory associated with the
  3950.         variable (and possibly related string storage).
  3951.  
  3952.         Example:
  3953.           A = "A variable"
  3954.           B = "Another one"
  3955.           Drop(A, B)   ; This removes A and B from memory
  3956.  
  3957.  
  3958.  
  3959.         EndSession
  3960.  
  3961.         Ends the Windows session.
  3962.  
  3963.         Syntax:
  3964.           EndSession ( )
  3965.  
  3966.         Use this command to end the Windows session.  This command is
  3967.         equivalent to closing the Program Manager window.
  3968.  
  3969.         Example:
  3970.           Sure = AskYesNo ("End Session", "You SURE you want to exit
  3971.             Windows?")
  3972.           If Sure == @No Then Goto Cancel
  3973.           EndSession()
  3974.           :Cancel
  3975.           Message("", "Exit Windows canceled")
  3976.  
  3977.         See Also:
  3978.           Exit, WinClose, WinCloseNot
  3979.  
  3980.  
  3981.  
  3982.  
  3983.         52
  3984.  
  3985.                                                    WBL FUNCTION REFERENCE
  3986.  
  3987.  
  3988.  
  3989.         Environment
  3990.  
  3991.         Gets a DOS environment variable.
  3992.  
  3993.         Syntax:
  3994.           Environment (env-variable)
  3995.  
  3996.         Parameters:
  3997.           "env-variable" =  any defined environment variable.
  3998.  
  3999.         Returns:
  4000.           (string)  environment variable contents.
  4001.  
  4002.         Use this command to query the DOS environment.
  4003.  
  4004.         Example:
  4005.           ; Display the PATH for this DOS session
  4006.           CurrPath = Environment("PATH")
  4007.           Message("Current DOS Path", CurrPath)
  4008.  
  4009.         See Also:
  4010.           IniRead, Version, WinVersion
  4011.  
  4012.  
  4013.  
  4014.         ErrorMode
  4015.  
  4016.         Specifies how to handle errors.
  4017.  
  4018.         Syntax:
  4019.           ErrorMode (mode)
  4020.  
  4021.         Parameters:
  4022.           mode =    @CANCEL or @NOTIFY or @OFF.
  4023.  
  4024.         Returns:
  4025.           (integer) previous error setting.
  4026.  
  4027.         Use this command to control the effects of runtime errors.  The
  4028.         default is @CANCEL, meaning the execution of the batch file will
  4029.         be canceled for any error.
  4030.  
  4031.         @CANCEL:  All runtime errors will cause execution to be
  4032.         canceled.  The user will be notified which error occurred.
  4033.  
  4034.         @NOTIFY:  All runtime errors will be reported to the user, and
  4035.         they can choose to continue if it isn't fatal.
  4036.  
  4037.         @OFF:  Minor runtime errors will be suppressed. Moderate and
  4038.         fatal errors will be reported to the user.  User has the option
  4039.         of continuing if the error is not fatal.
  4040.         In general we suggest the normal state of the program should be
  4041.         ErrorMode(@CANCEL), especially if you are writing a batch file
  4042.         for others to use.  You can always suppress errors you expect
  4043.         will occur and then re-enable ErrorMode (@CANCEL).
  4044.  
  4045.  
  4046.  
  4047.  
  4048.  
  4049.  
  4050.  
  4051.                                                                        53
  4052.  
  4053.         WBL FUNCTION REFERENCE
  4054.  
  4055.  
  4056.  
  4057.         Example:
  4058.           ; Delete xxxtest.xyz.
  4059.           ; If file doesn't exist, continue execution; don't stop
  4060.           prevmode = ErrorMode(@OFF)
  4061.           FileDelete("c:\xxxtest.xyz")
  4062.           ErrorMode(prevmode)
  4063.  
  4064.         See Also:
  4065.           Debug, LastError
  4066.  
  4067.  
  4068.  
  4069.         Execute
  4070.  
  4071.         Executes a statement in a protected environment.  Any errors
  4072.         encountered are recoverable.
  4073.  
  4074.         Syntax:
  4075.           Execute statement
  4076.  
  4077.         Parameters:
  4078.           "statement" =  is (hopefully) an executable statement.
  4079.  
  4080.         Use this command to execute computed or user-entered statements.
  4081.         Due to the built-in error recovery associated with the Execute
  4082.         statement, it is ideal for interactive execution of user-entered
  4083.         commands.
  4084.  
  4085.         Note the Execute statement doesn't operate on a string per se,
  4086.         but rather on a direct statement.  If you want to put a code
  4087.         segment into a string variable you must use the substitution
  4088.         feature of the language, as in the example below.
  4089.  
  4090.         Example:
  4091.           cmd = ""
  4092.           cmd = AskLine("WBL Interactive", "Command:", cmd)
  4093.           execute %cmd%
  4094.  
  4095.  
  4096.  
  4097.         Exit
  4098.  
  4099.         Terminates the batch file being interpreted.
  4100.  
  4101.         Syntax:
  4102.           Exit
  4103.  
  4104.         Use this command to prematurely exit a batch file process.  An
  4105.         exit is implied at the end of each batch file.
  4106.  
  4107.         Example:
  4108.           a = 100
  4109.           message("The value of a is", a)
  4110.           exit
  4111.  
  4112.  
  4113.  
  4114.  
  4115.  
  4116.  
  4117.         54
  4118.  
  4119.                                                    WBL FUNCTION REFERENCE
  4120.  
  4121.  
  4122.  
  4123.         See Also:
  4124.           Pause
  4125.  
  4126.  
  4127.  
  4128.         Exclusive
  4129.  
  4130.         Controls whether or not other Windows program will get any time
  4131.         to execute.
  4132.  
  4133.         Syntax:
  4134.           Exclusive (mode)
  4135.  
  4136.         Parameters:
  4137.           mode =    @ON or @OFF.
  4138.  
  4139.         Returns:
  4140.           (integer) previous Exclusive mode.
  4141.  
  4142.         Exclusive(@ON) runs the fastest but does not allow other Windows
  4143.         applications to get much time.  Exclusive(@OFF) runs just a tad
  4144.         slower, is the default, and is nicely mannered to other
  4145.         applications.
  4146.  
  4147.         Example:
  4148.           ; We want Excel to get top processing priority
  4149.           RunZoom("excel.exe, "")
  4150.           Exclusive(@ON)
  4151.           ; When we're done with Excel, return to default mode
  4152.           WinWaitClose ("Microsoft Excel")
  4153.           Exclusive(@OFF)
  4154.  
  4155.  
  4156.  
  4157.         FileClose
  4158.  
  4159.         Closes a file.
  4160.  
  4161.         Syntax:
  4162.           Fileclose (filehandle)
  4163.  
  4164.         Parameters:
  4165.           filehandle = same integer that was returned by FileOpen.
  4166.  
  4167.         Returns:
  4168.           (integer) always 0.
  4169.  
  4170.         Example:
  4171.           ; the hard way to copy an ascii file
  4172.           old = FileOpen("config.sys", "READ")
  4173.           new = FileOpen("sample.txt", "WRITE")
  4174.           :top
  4175.           x = FileRead(old)
  4176.           If x != "*EOF*" Then FileWrite(new, x)
  4177.           If x != "*EOF*" Then Goto top
  4178.  
  4179.  
  4180.  
  4181.  
  4182.  
  4183.                                                                        55
  4184.  
  4185.         WBL FUNCTION REFERENCE
  4186.  
  4187.  
  4188.  
  4189.           FileClose(new)
  4190.           FileClose(old)
  4191.  
  4192.  
  4193.  
  4194.         FileCopy
  4195.  
  4196.         Copies files.
  4197.  
  4198.         Syntax:
  4199.           FileCopy (source-list, destination, warning)
  4200.  
  4201.         Parameters:
  4202.           "source-list" =   a string containing one or more filenames,
  4203.                     which may be wildcarded.
  4204.           "destination" =   target file name.
  4205.  
  4206.           warning = @TRUE if you want a warning before
  4207.                     overwriting existing files;
  4208.                     @FALSE if no warning desired.
  4209.  
  4210.         Returns:
  4211.           (integer)    @TRUE if all files were copied successfully;
  4212.                        @FALSE if at least one file wasn't copied.
  4213.  
  4214.         Use this command to copy an individual file, a group of files
  4215.         using wildcards, or several groups of files by separating the
  4216.         names with spaces.
  4217.         You can also copy files to any COM or LPT device.
  4218.  
  4219.         "Source-list" may contain * and ? wildcards.  "Destination" may
  4220.         contain the * wildcard only.
  4221.  
  4222.         Errors:
  4223.           1006 "File Copy/Move: No matching files found"
  4224.           2002 "File Copy/Move: 'From' file illegal"
  4225.           2003 "File Copy/Move: 'To'   file illegal"
  4226.           2004 "File Copy/Move: Cannot copy/move wildcards into fixed
  4227.                 root"
  4228.           2005 "File Copy/Move: Cannot copy/move wildcards into fixed
  4229.                 extension"
  4230.           3118 "FileCopyMove: Destination file same as source"
  4231.  
  4232.         Examples:
  4233.           FileCopy("c:\config.sys", "d:", @FALSE)
  4234.           FileCopy("c:\*.sys", "d:devices\*.sys", @TRUE)
  4235.           FileCopy("c:\config.sys", "LPT1:", @FALSE)
  4236.  
  4237.         See Also:
  4238.           FileDelete, FileExist, FileLocate, FileMove, FileRename
  4239.  
  4240.  
  4241.  
  4242.         FileDelete
  4243.  
  4244.         Deletes files.
  4245.  
  4246.  
  4247.  
  4248.  
  4249.  
  4250.         56
  4251.  
  4252.                                                    WBL FUNCTION REFERENCE
  4253.  
  4254.  
  4255.  
  4256.         Syntax:
  4257.           FileDelete (file-list)
  4258.  
  4259.         Parameters:
  4260.           "file-list" =  a string containing one or more filenames,
  4261.                     which may be wildcarded.
  4262.         Returns:
  4263.           (integer) @TRUE if all the files were deleted;
  4264.                     @FALSE if a file didn't exist or is marked with the
  4265.                     READ-ONLY attribute.
  4266.  
  4267.         Use this command to delete an individual file, a group of files
  4268.         using wildcards, or several groups of files by separating the
  4269.         names with spaces.
  4270.  
  4271.         Errors:
  4272.           1017 "File Delete: No matching files found"
  4273.           1018 "File Delete: Delete Failed"
  4274.           2016 "File Delete: File name illegal"
  4275.  
  4276.         Example:
  4277.           WasDeleted = FileDelete("badfile")
  4278.  
  4279.         See Also:
  4280.           FileExist, FileLocate, FileMove, FileRename
  4281.  
  4282.  
  4283.  
  4284.         FileExist
  4285.  
  4286.         Tests for the existence of files.
  4287.  
  4288.         Syntax:
  4289.           FileExist (filename)
  4290.  
  4291.         Parameters:
  4292.           "filename" = either a fully qualified filename with drive and
  4293.                     path, or just a filename and extension.
  4294.         Returns:
  4295.           (integer) @TRUE if the file exists;
  4296.                     @FALSE if it doesn't or if the pathname is invalid.
  4297.  
  4298.         This statement is used to test whether or not a specified file
  4299.         exists.
  4300.  
  4301.         If a fully qualified file name is used only the specified drive
  4302.         and directory will be checked for the desired file.  If only the
  4303.         root and extension are specified, then all the directories in the
  4304.         DOS PATH statement will be searched for the desired file.
  4305.  
  4306.  
  4307.  
  4308.  
  4309.  
  4310.  
  4311.  
  4312.  
  4313.  
  4314.  
  4315.                                                                        57
  4316.  
  4317.         WBL FUNCTION REFERENCE
  4318.  
  4319.  
  4320.  
  4321.         Example:
  4322.           ; check for file in current directory
  4323.           fex = FileExist(StrCat(DirGet(), "myfile.txt"))
  4324.           tex = StrSub("NOT", 1, StrLen("NOT") * fex)
  4325.           Message("MyFile.Txt"," Is %tex%in the current directory")
  4326.           ; check for file in someplace along path
  4327.           fex = FileExist("myfile.txt")
  4328.           tex = StrSub("NOT", 1, StrLen("NOT") * fex)
  4329.           Message("MyFile.Txt", " Is %tex% in the DOS path")
  4330.  
  4331.         See Also:
  4332.           FileLocate
  4333.  
  4334.  
  4335.  
  4336.         FileExtension
  4337.  
  4338.         Returns extension of file.
  4339.  
  4340.         Syntax:
  4341.           FileExtension (filename)
  4342.  
  4343.         Parameters:
  4344.           "filename" = [optional path]complete file name, with extension.
  4345.  
  4346.         FileExtension parses the passed filename and returns the
  4347.         extension part of the filename.
  4348.  
  4349.         Example:
  4350.           ; prevent the user from editing a COM or EXE file
  4351.           allfiles = FileItemize("*.*")
  4352.           editfile = ItemSelect("Select a file to edit", allfiles, " ")
  4353.           ext = FileExtension(editfile)
  4354.           If (ext == "com") || (ext == "exe") Then Goto noedit
  4355.           run("notepad.exe", editfile)
  4356.           exit
  4357.           :noedit
  4358.           Message ("Sorry", "You may not edit a program file")
  4359.  
  4360.  
  4361.  
  4362.         FileItemize
  4363.  
  4364.         Returns a space-delimited list of files.
  4365.  
  4366.         Syntax:
  4367.           FileItemize (file-list)
  4368.  
  4369.         Parameters:
  4370.           "file-list" =  a string containing a list of filenames, which
  4371.                     may be wildcarded.
  4372.  
  4373.         Returns:
  4374.           (string)  space-delimited list of files.
  4375.  
  4376.  
  4377.  
  4378.  
  4379.         58
  4380.  
  4381.                                                    WBL FUNCTION REFERENCE
  4382.  
  4383.  
  4384.  
  4385.  
  4386.         This function compiles a list of filenames and separates the
  4387.         names with spaces.
  4388.  
  4389.         FileItemize("*.BAK") ;returns all BAK's
  4390.         FileItemize("*.ARC *.ZIP *.LZH") ;returns list of compressed
  4391.         files
  4392.  
  4393.         This is especially useful in conjunction with the ItemSelect
  4394.         function, which enables the user to choose an item from such a
  4395.         space-delimited list.
  4396.  
  4397.         Examples:
  4398.           ; Get which .INI file to edit
  4399.           ifiles = FileItemize("c:\windows\*.ini")
  4400.           ifile = ItemSelect(".INI Files", ifiles, " ")
  4401.           RunZoom("notepad", ifile)
  4402.           Drop(ifiles, ifile)
  4403.  
  4404.         See Also:
  4405.           DirItemize, WinItemize, ItemSelect
  4406.  
  4407.  
  4408.  
  4409.         FileLocate
  4410.  
  4411.         Finds file in current directory or along the DOS PATH.
  4412.  
  4413.         Syntax:
  4414.           FileLocate (filename)
  4415.  
  4416.         Parameters:
  4417.           "filename" = root name, ".", and an extension.
  4418.  
  4419.         Returns:
  4420.           (string)  fully qualified path name.
  4421.  
  4422.         This function is used to obtain the fully qualified path name of
  4423.         a file.  The current directory is checked first, and if the file
  4424.         is not found the DOS path is searched.  This function returns the
  4425.         first occurrence of the file.
  4426.  
  4427.         Example:
  4428.           ; Edit WIN.INI
  4429.           winini = FileLocate("win.ini")
  4430.           If winini == "" Then Goto notfound
  4431.           Run("notepad.exe", winini)
  4432.           Exit
  4433.           :notfound
  4434.           Message("???", "WIN.INI not found")
  4435.  
  4436.         See Also:
  4437.           FileExist
  4438.  
  4439.  
  4440.  
  4441.  
  4442.  
  4443.  
  4444.                                                                        59
  4445.  
  4446.         WBL FUNCTION REFERENCE
  4447.  
  4448.  
  4449.  
  4450.         FileMove
  4451.  
  4452.         Moves files.
  4453.  
  4454.         Syntax:
  4455.           FileMove (source-list, destination, warning)
  4456.  
  4457.         Parameters:
  4458.           "source-list" =   one or more filenames separated by spaces.
  4459.           "destination" =   target filename.
  4460.           warning =         @TRUE if you want a warning before
  4461.                             overwriting existing files; @FALSE if no
  4462.                             warning desired.
  4463.  
  4464.         Returns:
  4465.           (integer) @TRUE if the file was moved;
  4466.                     @FALSE if the source file was not found or had the
  4467.                     READ-ONLY attribute, or the target filename is
  4468.                     invalid.
  4469.  
  4470.         Use this command to move an individual file, a group of files
  4471.         using wildcards, or several groups of files by separating the
  4472.         names with spaces.
  4473.  
  4474.         You can also move files to another drive, or to any COM or LPT
  4475.         device.
  4476.  
  4477.         "Source-list" may contain * and ? wildcards.  "Destination" may
  4478.         contain the * wildcard only.
  4479.  
  4480.         Errors:
  4481.           1006 "File Copy/Move: No matching files found"
  4482.           2002 "File Copy/Move: 'From' file illegal"
  4483.           2003 "File Copy/Move: 'To'   file illegal"
  4484.           2004 "File Copy/Move: Cannot copy/move wildcards into fixed
  4485.                 root"
  4486.           2005 "File Copy/Move: Cannot copy/move wildcards into fixed
  4487.                 extension"
  4488.           2007 "File Move: Unable to rename source file"
  4489.           2015 "File Move:  Unable to remove source file"
  4490.  
  4491.         Example:
  4492.           FileMove("c:\config.sys", "d:", @FALSE)
  4493.           FileMove("c:\*.sys", "d:*.sys", @TRUE)
  4494.  
  4495.         See Also:
  4496.           FileCopy, FileDelete, FileExist, FileLocate, FileRename
  4497.  
  4498.  
  4499.  
  4500.         FileOpen
  4501.  
  4502.         Opens a STANDARD ASCII (only) file for reading or writing.
  4503.  
  4504.         Syntax:
  4505.           Fileopen ( filename, open-type)
  4506.  
  4507.  
  4508.  
  4509.  
  4510.  
  4511.         60
  4512.  
  4513.                                                    WBL FUNCTION REFERENCE
  4514.  
  4515.  
  4516.  
  4517.         Parameters:
  4518.           "filename" = name of the file to open.
  4519.           open-type =  READ or WRITE.
  4520.  
  4521.         Returns:
  4522.           (special integer) filehandle
  4523.  
  4524.         The filehandle returned by the FileOpen function is subsequently
  4525.         used by the FileRead,FileWrite and FileClose functions.
  4526.  
  4527.         Examples:
  4528.  
  4529.         To open for reading:
  4530.           FileOpen("stuff.txt", "READ")
  4531.  
  4532.         To open for writing:
  4533.           FileOpen("stuff.txt", "WRITE")
  4534.  
  4535.  
  4536.  
  4537.         FilePath
  4538.  
  4539.         Returns path of file.
  4540.  
  4541.         Syntax:
  4542.           FilePath (filename)
  4543.  
  4544.         Parameters:
  4545.           "filename" = fully qualified file name, including path.
  4546.  
  4547.         FilePath parses the passed filename and returns the drive and
  4548.         path of the file specification, if any.
  4549.  
  4550.         Example:
  4551.           coms = environment("comspec")
  4552.           compath = FilePath(coms)
  4553.           Message("", "Your command processor is located in the
  4554.             %compath% directory")
  4555.  
  4556.  
  4557.  
  4558.         FileRead
  4559.  
  4560.         Reads data from a file.
  4561.  
  4562.         Syntax:
  4563.           Fileread(filehandle)
  4564.  
  4565.         Parameters:
  4566.           filehandle = same integer that was returned by FileOpen.
  4567.  
  4568.         Returns:
  4569.           (string)  line of data read from file.
  4570.  
  4571.         At EOF the string *EOF* will be returned.
  4572.  
  4573.         Example:
  4574.           handle = FileOpen("autoexec.bat", "READ")
  4575.  
  4576.  
  4577.  
  4578.  
  4579.                                                                        61
  4580.  
  4581.         WBL FUNCTION REFERENCE
  4582.  
  4583.  
  4584.  
  4585.           :top
  4586.           line = FileRead(handle)
  4587.           Display(4, "AUTOEXEC DATA", line)
  4588.           If line != "*EOF*" Then Goto top
  4589.           FileClose(handle)
  4590.  
  4591.  
  4592.  
  4593.         FileRename
  4594.  
  4595.         Renames files.
  4596.  
  4597.         Syntax:
  4598.           FileRename (source-list, destination)
  4599.  
  4600.         Parameters:
  4601.           "source-list" =   one or more filenames separated by spaces.
  4602.           "destination" =   target filename.
  4603.  
  4604.         Returns:
  4605.           (integer) @TRUE if the file was renamed;
  4606.                     @FALSE if the source file was not found or had the
  4607.                     READ-ONLY attribute, or the target filename is
  4608.                     invalid.
  4609.  
  4610.         Use this command to rename an individual file, a group of files
  4611.         using wildcards, or several groups of files by separating the
  4612.         names with spaces.
  4613.         Note: Unlike FileMove, you cannot make a file change its resident
  4614.         disk drive with FileRename.
  4615.  
  4616.         "Source-list" may contain * and ? wildcards.  "Destination" may
  4617.         contain the * wildcard only.
  4618.  
  4619.         Errors:
  4620.           1024 "File Rename: No matching files found"
  4621.           1025 "File Rename: Rename failed"
  4622.           2019 "File Rename: 'From' file illegal"
  4623.           2020 "File Rename: 'To' file illegal"
  4624.           2021 "File Rename: Attempt to rename across drive boundary. -
  4625.                 Use MOVE instead."
  4626.           2022 "File Rename: Cannot rename wildcards into a fixed
  4627.                 filename root"
  4628.           2023 "File Rename: Cannot rename wildcards into a fixed
  4629.                 filename extension"
  4630.  
  4631.         Example:
  4632.           FileRename("c:\config.sys", "config.old")
  4633.           FileRename("c:\*.txt", "*.bak")
  4634.  
  4635.         See Also:
  4636.           FileCopy, FileExist, FileLocate, FileMove
  4637.  
  4638.  
  4639.  
  4640.  
  4641.  
  4642.  
  4643.  
  4644.  
  4645.         62
  4646.  
  4647.                                                    WBL FUNCTION REFERENCE
  4648.  
  4649.  
  4650.  
  4651.         FileRoot
  4652.  
  4653.         Returns root of file.
  4654.  
  4655.         Syntax:
  4656.           FileRoot (filename)
  4657.  
  4658.         Parameters:
  4659.           "filename" = [optional path]complete file name, with extension.
  4660.  
  4661.         FileRoot parses the passed filename and returns the root part of
  4662.         the filename.
  4663.  
  4664.         Example:
  4665.           allfiles = FileItemize("*.*")
  4666.           editfile = ItemSelect("Select a file to edit", allfiles, " ")
  4667.           root = FileRoot(editfile)
  4668.           ext = FileExtension(editfile)
  4669.           lowerext = StrLower(ext)
  4670.           nicefile = StrCat(root, ".", lowerext)
  4671.           Message("", "You are about to edit %nicefile%.")
  4672.           run("notepad.exe", editfile)
  4673.  
  4674.  
  4675.  
  4676.         FileSize
  4677.  
  4678.         Finds the total size of a group of files.
  4679.  
  4680.         Syntax:
  4681.           FileSize (file-list)
  4682.  
  4683.         Parameters:
  4684.           "file-list" =  zero or more filenames, separated by spaces.
  4685.  
  4686.         Returns:
  4687.           (integer) total bytes taken up by the specified files.
  4688.  
  4689.         This function returns the total size of the specified files.
  4690.         Note it doesn't handle wildcarded filenames.  You can, however,
  4691.         use FileItemize on a wildcarded filename and use the resulting
  4692.         string with as a FileSize parameter.
  4693.  
  4694.         Errors:
  4695.           3112 "FileSize:  File Not Found"
  4696.  
  4697.         Example:
  4698.           size = FileSize(FileItemize(""))
  4699.           Message("Size of Highlighted Files", size)
  4700.  
  4701.         See Also:
  4702.           DiskFree
  4703.  
  4704.  
  4705.  
  4706.  
  4707.  
  4708.  
  4709.  
  4710.  
  4711.                                                                        63
  4712.  
  4713.         WBL FUNCTION REFERENCE
  4714.  
  4715.  
  4716.  
  4717.         FileWrite
  4718.  
  4719.         Writes data to a file.
  4720.  
  4721.         Syntax:
  4722.           Filewrite(filehandle,output-data)
  4723.  
  4724.         Parameters:
  4725.           filehandle = same integer that was returned by FileOpen.
  4726.           "output-data" =   data to write to file.
  4727.  
  4728.         Returns:
  4729.           (integer) always 0.
  4730.  
  4731.         Example:
  4732.           handle = FileOpen("stuff.txt", "WRITE")
  4733.           FileWrite(handle, "Gobbledygook")
  4734.           FileClose(handle)
  4735.  
  4736.  
  4737.  
  4738.         Goto
  4739.  
  4740.         Changes the flow of control in a batch file.
  4741.  
  4742.         Syntax:
  4743.           Goto label
  4744.  
  4745.         Parameters:
  4746.           "label" = user-defined identifier.
  4747.  
  4748.         Note:  labels begin with a colon (:)
  4749.  
  4750.         Example:
  4751.           a = 0
  4752.           :loop
  4753.           If A > 5 Then Goto next
  4754.           Message("A is now", a)
  4755.           a = a + 1
  4756.           Goto loop
  4757.           :next
  4758.           Message("DONE", "Loop Exited")
  4759.  
  4760.  
  4761.  
  4762.         If_Then
  4763.  
  4764.         Conditionally performs a function.
  4765.  
  4766.         Syntax:
  4767.           If condition Then statement
  4768.  
  4769.         If the condition following the If keyword is true, the statement
  4770.         following the Then keyword is executed.  If the condition
  4771.         following the If keyword is false, the statement following the
  4772.         Then keyword is ignored.
  4773.  
  4774.  
  4775.  
  4776.  
  4777.  
  4778.  
  4779.         64
  4780.  
  4781.                                                    WBL FUNCTION REFERENCE
  4782.  
  4783.  
  4784.  
  4785.         Example:
  4786.           If a > 5 Then Message("Hello", "A GT 5")
  4787.  
  4788.  
  4789.  
  4790.         IgnoreInput
  4791.  
  4792.         Turns off hardware input to windows.
  4793.  
  4794.         Syntax:
  4795.           IgnoreInput(mode)
  4796.  
  4797.         Parameters:
  4798.           mode =    @TRUE or @FALSE.
  4799.  
  4800.         Returns:
  4801.           (integer) previous IgnoreInput mode.
  4802.  
  4803.         IgnoreInput causes mouse movements, clicks and keyboard entry to
  4804.         be completely ignored.  Good for self-running demos.
  4805.  
  4806.         Warning: If you are not careful with the use of IgnoreInput, you
  4807.         can hang your machine.
  4808.  
  4809.         Example:
  4810.           username = AskLine("Hello", "Please enter your name","")
  4811.           IgnoreInput(@TRUE)
  4812.           Call("demo.wbt", "username")
  4813.           IgnoreInput(@FALSE)
  4814.  
  4815.  
  4816.  
  4817.         IniRead
  4818.  
  4819.         Reads data from the WIN.INI file.
  4820.  
  4821.         Syntax:
  4822.           IniRead (section, keyname, default)
  4823.  
  4824.         Parameters:
  4825.           "section" =  the major heading to read the data from.
  4826.           "keyname =   the name of the item to read.
  4827.           "default" =  string to return if the desired item is not found.
  4828.  
  4829.         Returns:
  4830.           (string)  data from WIN.INI file.
  4831.  
  4832.         This command allows a program to read data from the WIN.INI file.
  4833.         The WIN.INI file has the form:
  4834.  
  4835.           [section]
  4836.           keyname=settings
  4837.  
  4838.         Most of the entries in WIN.INI are set from the Windows Control
  4839.         Panel program, but individual applications can also use it to
  4840.         store option settings in their own sections.
  4841.  
  4842.  
  4843.  
  4844.  
  4845.  
  4846.  
  4847.                                                                        65
  4848.  
  4849.         WBL FUNCTION REFERENCE
  4850.  
  4851.  
  4852.  
  4853.         Example:
  4854.           ; Find the default output device:
  4855.           a = IniRead("windows", "device", "No Default")
  4856.           Message("Default Output Device", a)
  4857.  
  4858.         See Also:
  4859.           Environment, IniWrite
  4860.  
  4861.  
  4862.  
  4863.         IniReadPvt
  4864.  
  4865.         For reading private ini files.
  4866.  
  4867.         Syntax:
  4868.           IniReadPvt (section, keyname, default,filename)
  4869.  
  4870.         Parameters:
  4871.           "section" =  the major heading to read the data from.
  4872.           "keyname =   the name of the item to read.
  4873.           "default" =  string to return if the desired item is not found.
  4874.           "filename" = name of the INI file.
  4875.  
  4876.         Returns:
  4877.           (string)  data from the INI file.
  4878.  
  4879.         Looks up a value in the "filename" ini file.  If the value is not
  4880.         found, the "default" will be returned.
  4881.  
  4882.         Example:
  4883.         Given the following segment from WB.INI
  4884.  
  4885.           [Main]
  4886.           Lang=German
  4887.  
  4888.         The statement:
  4889.  
  4890.           IniReadPvt("Main", "Lang", "English", "WB.INI")
  4891.  
  4892.         would return "German"
  4893.  
  4894.  
  4895.  
  4896.         IniWrite
  4897.  
  4898.         Writes data to the WIN.INI file.
  4899.  
  4900.         Syntax:
  4901.           IniWrite (section, keyname, data)
  4902.  
  4903.         Parameters:
  4904.           "section" =  major heading to write the data to.
  4905.           "keyname =   name of the data item to write.
  4906.           "data" =  string to write to the WIN.INI file.
  4907.  
  4908.         Returns:
  4909.           (integer) always @TRUE.
  4910.  
  4911.  
  4912.  
  4913.  
  4914.         66
  4915.  
  4916.                                                    WBL FUNCTION REFERENCE
  4917.  
  4918.  
  4919.  
  4920.  
  4921.         This command allows a program to write data to the WIN.INI file.
  4922.         The "section" is added to the file if it doesn't already exist.
  4923.  
  4924.         Example:
  4925.           ; Change the list of pgms to load upon Windows startup:
  4926.           loadprogs = IniRead("windows", "load", "")
  4927.           newprogs = AskLine("Add Pgm To LOAD= Line", "Add:", loadprogs)
  4928.           IniWrite("windows", "load", newprogs)
  4929.  
  4930.         See Also:
  4931.           IniRead
  4932.  
  4933.  
  4934.  
  4935.         IniWritePvt
  4936.  
  4937.         For writing private ini files.
  4938.  
  4939.         Syntax:
  4940.           IniWritePvt (section, keyname, data, filename)
  4941.  
  4942.         Parameters:
  4943.           "section" =  major heading to write the data to.
  4944.           "keyname =   name of the data item to write.
  4945.           "data" =  string to write to the INI file.
  4946.           "filename" = name of the INI file.
  4947.  
  4948.         Writes a value in the "filename" ini file.
  4949.  
  4950.         Example:
  4951.         The statement:
  4952.  
  4953.           IniWritePvt("Main", "Lang", "French, "WB.INI")
  4954.  
  4955.         would create the following entry in WB.INI:
  4956.  
  4957.           [Main]
  4958.           Lang=French
  4959.  
  4960.  
  4961.  
  4962.         IsDefined
  4963.  
  4964.         Determines if a variable name is currently defined.
  4965.  
  4966.         Syntax:
  4967.           IsDefined (var)
  4968.  
  4969.         Parameters:
  4970.           "var" =   a variable name.
  4971.  
  4972.         Returns:
  4973.           (integer) @YES if the variable is currently defined;
  4974.                     @NO if it was never defined or has been dropped.
  4975.  
  4976.  
  4977.  
  4978.  
  4979.  
  4980.                                                                        67
  4981.  
  4982.         WBL FUNCTION REFERENCE
  4983.  
  4984.  
  4985.  
  4986.         A variable is defined the first time it appears at the left of an
  4987.         equal sign in a statement.  It stays defined until it is
  4988.         explicitly Dropped.
  4989.  
  4990.         Example:
  4991.           def = IsDefined(thisvar)
  4992.           If def == @FALSE Then Message("ERROR!", "Variable not
  4993.             defined")
  4994.  
  4995.         See Also:
  4996.           Drop
  4997.  
  4998.  
  4999.  
  5000.         IsKeyDown
  5001.  
  5002.         Tells about keys/mouse.
  5003.  
  5004.         Syntax:
  5005.           IsKeyDown(keycodes)
  5006.  
  5007.         Parameters:
  5008.           keycodes =   @SHIFT and/or @CTRL
  5009.  
  5010.         Returns:
  5011.           (integer) @YES if the key is down.
  5012.                     @NO if the key is not down.
  5013.  
  5014.         Determines if the SHIFT key or the CTRL key is currently down.
  5015.         Note: Right mouse button is the same as SHIFT, and  Middle mouse
  5016.         button is the same as CTRL.
  5017.  
  5018.         Examples:
  5019.  
  5020.           IsKeyDown(@SHIFT)
  5021.           IsKeyDown(@CTRL)
  5022.           IsKeyDown(@CTRL | @SHIFT)
  5023.           IsKeyDown(@CTRL & @SHIFT)
  5024.  
  5025.  
  5026.  
  5027.         IsLicensed
  5028.  
  5029.         Tells if WinBatch is licensed.
  5030.  
  5031.         Syntax:
  5032.           IsLicensed()
  5033.  
  5034.         Returns:
  5035.           (integer) @YES if current version of WinBatch is licensed.
  5036.                     @NO if current version of WinBatch is not licensed.
  5037.  
  5038.         Returns whether or not the current version of WinBatch is a
  5039.         licensed copy or not.
  5040.  
  5041.  
  5042.  
  5043.  
  5044.  
  5045.  
  5046.         68
  5047.  
  5048.                                                    WBL FUNCTION REFERENCE
  5049.  
  5050.  
  5051.  
  5052.         Example:
  5053.           IsLicensed()
  5054.  
  5055.  
  5056.  
  5057.         IsNumber
  5058.  
  5059.         Determines whether a variable contains a valid number.
  5060.  
  5061.         Syntax:
  5062.           IsNumber (string)
  5063.  
  5064.         Parameters:
  5065.           "string" =   string to test to see if it represents a valid
  5066.                        number.
  5067.  
  5068.         Returns:
  5069.           (integer) @YES if it contains a valid number;
  5070.                     @NO if it doesn't.
  5071.  
  5072.         This function determines if a string variable contains a valid
  5073.         integer.  Useful for checking user input prior to using it in
  5074.         computations.
  5075.  
  5076.         Example:
  5077.           a = AskLine("ISNUMBER", "Enter a number", "0")
  5078.           If IsNumber(a) == @NO Then Message("", "You didn't enter a
  5079.             number")
  5080.  
  5081.         See Also:
  5082.           Abs, Char2Num
  5083.  
  5084.  
  5085.  
  5086.         ItemSelect
  5087.  
  5088.         Allows the user to choose an item from a listbox.
  5089.  
  5090.         Syntax:
  5091.           ItemSelect (title, list, delimiter)
  5092.  
  5093.         Parameters:
  5094.           "title" = the title of dialog box to display.
  5095.           "list" =  a string containing a list of items to choose from.
  5096.           "delimiter" =  a string containing the character to act as
  5097.                     delimiter between items in the list.
  5098.  
  5099.         Returns:
  5100.           (string)  the selected item.
  5101.  
  5102.         This function displays a dialog box with a listbox inside.  This
  5103.         listbox is filled with a list of items taken from a string you
  5104.         provide to the function.
  5105.         Each item in the string must be separated ("delimited") by a
  5106.         character, which you also pass to the function.
  5107.  
  5108.  
  5109.  
  5110.  
  5111.  
  5112.  
  5113.                                                                        69
  5114.  
  5115.         WBL FUNCTION REFERENCE
  5116.  
  5117.  
  5118.  
  5119.         The user selects one of the items by either doubleclicking on it,
  5120.         or single-clicking and pressing OK.  The item is returned as a
  5121.         string.
  5122.  
  5123.         If you create the list with the FileItemize or DirItemize
  5124.         functions you will be using a space-delimited list.  WinItemize,
  5125.         however, creates a tab-delimited list of window titles since
  5126.         titles can have embedded blanks.
  5127.  
  5128.         Example:
  5129.           Files = FileItemize("*.bmp")
  5130.           thefile = ItemSelect("Bitmap Files", Files, " ")
  5131.           Run("pbrush.exe", thefile)
  5132.  
  5133.         See Also:
  5134.           AskYesNo, Display,  DirItemize, FileItemize, WinItemize,
  5135.           Message, Pause, TextBox
  5136.  
  5137.  
  5138.  
  5139.         LastError
  5140.  
  5141.         Returns the most-recent error encountered during the current
  5142.         batch file.
  5143.  
  5144.         Syntax:
  5145.           LastError ( )
  5146.  
  5147.         Returns:
  5148.           (integer) most-recent WBL error code encountered.
  5149.  
  5150.         WBL errors are numbered according to their severity.  "Minor"
  5151.         errors go from 1000 through 1999.  Moderate errors are 2000
  5152.         through 2999.  Fatal errors are numbered 3000 to 3999.
  5153.         Depending on which error mode is active when an error occurs, you
  5154.         may not get a chance to check the error code.  See ErrorMode for
  5155.         a discussion of default error handling.
  5156.  
  5157.         Don't bother checking for "fatal" error codes.  When a fatal
  5158.         error occurs, the batch file is canceled before the next WBL
  5159.         statement gets to execute (regardless of which error mode is
  5160.         active).
  5161.  
  5162.         Calling LastError itself resets the last error indicator back to
  5163.         zero.
  5164.  
  5165.         A full listing of possible errors you can encounter in processing
  5166.         a batch file is in Appendix B - Errors.
  5167.  
  5168.         Example:
  5169.           ErrorMode(@OFF)
  5170.           FileCopy("data.dat", "c:\backups", @FALSE)
  5171.           ErrorMode(@CANCEL)
  5172.           If LastError() == 1006 Then Message("Error", "Please call Tech
  5173.             Support at 555-9999.")
  5174.  
  5175.  
  5176.  
  5177.  
  5178.  
  5179.         70
  5180.  
  5181.                                                    WBL FUNCTION REFERENCE
  5182.  
  5183.  
  5184.  
  5185.         See Also:
  5186.           Debug, ErrorMode
  5187.  
  5188.  
  5189.  
  5190.         LogDisk
  5191.  
  5192.         Logs (activates) a disk drive.
  5193.  
  5194.         Syntax:
  5195.           LogDisk (drive-letter)
  5196.  
  5197.         Parameters:
  5198.           "drive-letter" =  is the disk drive to log into.
  5199.  
  5200.         Returns:
  5201.           (integer) @TRUE if the current drive was changed;
  5202.                     @FALSE if the drive doesn't exist.
  5203.  
  5204.         Use this command to change the logged disk drive.
  5205.  
  5206.         This command produces the same effect as if you typed the drive
  5207.         name from the DOS command prompt.
  5208.  
  5209.         Errors:
  5210.           1028 "LogDisk: Requested drive not online"
  5211.  
  5212.         Example:
  5213.           logdisk("c:")
  5214.  
  5215.         See Also:
  5216.           DirChange
  5217.  
  5218.  
  5219.  
  5220.         Max
  5221.  
  5222.         Returns largest number in a list of numbers.
  5223.  
  5224.         Syntax:
  5225.           Max (integer [, integer]...)
  5226.  
  5227.         Parameters:
  5228.           integer = number.
  5229.  
  5230.         Returns:
  5231.           (integer) largest parameter.
  5232.  
  5233.         Use this function to determine the largest of a set of numbers.
  5234.  
  5235.         Example:
  5236.           a = Max(5, -37, 125, 34, 2345, -32767)
  5237.           Message("Largest number is", a)
  5238.  
  5239.         See Also:
  5240.           Abs, Average, Min
  5241.  
  5242.  
  5243.  
  5244.  
  5245.  
  5246.                                                                        71
  5247.  
  5248.         WBL FUNCTION REFERENCE
  5249.  
  5250.  
  5251.  
  5252.         Message
  5253.  
  5254.         Displays a message to the user.
  5255.  
  5256.         Syntax:
  5257.           Message (title, text)
  5258.  
  5259.         Parameters:
  5260.           "title" = title of the message box.
  5261.           "text" =  text to display in the message box.
  5262.  
  5263.         Returns:
  5264.           (integer) always @TRUE.
  5265.  
  5266.         Use this command to display a message to the user.  The user must
  5267.         respond by selecting the OK button before processing will
  5268.         continue.
  5269.  
  5270.         Example:
  5271.           Message("GUESSIT", "Pick a number between 1 and 100")
  5272.           Message("GUESSIT", "Multiply your number by 2")
  5273.           Message("GUESSIT", "Add 34")
  5274.           Message("GUESSIT", "Divide by 2")
  5275.           Message("GUESSIT", "Subtract your original number")
  5276.           Message("GUESSIT", "Your answer is 17")
  5277.  
  5278.         See Also:
  5279.           Display, Pause
  5280.  
  5281.  
  5282.  
  5283.         Min
  5284.  
  5285.         Returns lowest number in a list of numbers.
  5286.  
  5287.         Syntax:
  5288.           Min (integer [, integer]...)
  5289.  
  5290.         Parameters:
  5291.           integer = any integer number.
  5292.  
  5293.         Returns:
  5294.           (integer) lowest parameter.
  5295.  
  5296.         Use this function to determine the lowest of a set of integers.
  5297.  
  5298.         Example:
  5299.           a = Min( 5, -37, 125, 34, 2345, -32767)
  5300.           Message("Smallest number is", a)
  5301.  
  5302.         See Also:
  5303.           Abs, Average, Max
  5304.  
  5305.  
  5306.  
  5307.  
  5308.  
  5309.  
  5310.  
  5311.  
  5312.         72
  5313.  
  5314.                                                    WBL FUNCTION REFERENCE
  5315.  
  5316.  
  5317.  
  5318.         Num2Char
  5319.  
  5320.         Converts a number to its character equivalent.
  5321.  
  5322.         Syntax:
  5323.           Num2Char (integer)
  5324.  
  5325.         Parameters:
  5326.           number =  any number from 0 to 255.
  5327.  
  5328.         Returns:
  5329.           (string)  one-byte string containing the character the number
  5330.                     represents.
  5331.  
  5332.         Use this command to convert a number to its ASCII equivalent.
  5333.  
  5334.         Example:
  5335.           ; Build a variable containing a CRLF combo
  5336.           crlf = StrCat(Num2Char(13), Num2Char(10))
  5337.           Message("NUM2CHAR", StrCat("line1", crlf, "line2"))
  5338.  
  5339.         See Also:
  5340.           Char2Num
  5341.  
  5342.  
  5343.  
  5344.         ParseData
  5345.  
  5346.         Parses the passed string, just like passed parameters are parsed.
  5347.  
  5348.         Syntax:
  5349.           Parsedata (string)
  5350.  
  5351.         Parameters:
  5352.           "string" =   string to be parsed.
  5353.  
  5354.         Variables show up as param1, param2, etc.  Param0 is the count of
  5355.         the number of parameters.
  5356.  
  5357.         Example:
  5358.           username = AskLine("Hello", "Please enter your name","")
  5359.           ParseData(username)
  5360.  
  5361.         If the user entered
  5362.  
  5363.           Joe Q. User
  5364.  
  5365.         ParseData would create the following variables:
  5366.  
  5367.              param0 == 3
  5368.              param1 == "Joe"
  5369.              param2 == "Q."
  5370.              param3 == "User"
  5371.  
  5372.  
  5373.  
  5374.  
  5375.  
  5376.  
  5377.  
  5378.                                                                        73
  5379.  
  5380.         WBL FUNCTION REFERENCE
  5381.  
  5382.  
  5383.  
  5384.         Pause
  5385.  
  5386.         Provides a message to user.  User may cancel processing.
  5387.  
  5388.         Syntax:
  5389.           Pause (title, text)
  5390.  
  5391.         Parameters:
  5392.           "title" = title of pause box.
  5393.           "text" =  text of the message to be displayed.
  5394.  
  5395.         Returns:
  5396.           (integer)    always @TRUE.
  5397.  
  5398.         This command displays a message to the user with an exclamation
  5399.         point icon.  The user may respond by selecting the OK button, or
  5400.         they may cancel the processing by selecting CANCEL.
  5401.  
  5402.         The Pause command is similar to the Message command except for
  5403.         the addition of the CANCEL button and icon.
  5404.  
  5405.         Example:
  5406.           Pause("Change Disks", "Insert new disk into Drive A:")
  5407.  
  5408.         See Also:
  5409.           Display, Message
  5410.  
  5411.  
  5412.  
  5413.         Random
  5414.  
  5415.         Computes a pseudo-random number.
  5416.  
  5417.         Syntax:
  5418.           Random (max)
  5419.  
  5420.         Parameters:
  5421.           max =     largest desired number.
  5422.  
  5423.         Returns:
  5424.           (integer) unpredictable positive number.
  5425.  
  5426.         This function will return a random integer between 0 and "max".
  5427.  
  5428.         Example:
  5429.           a = Random(79)
  5430.           Message("Random number between 0 and 79", a)
  5431.  
  5432.  
  5433.  
  5434.         Return
  5435.  
  5436.         Used to return from a Call or a CallExt to the calling program.
  5437.  
  5438.         Syntax:
  5439.           Return
  5440.  
  5441.  
  5442.  
  5443.  
  5444.  
  5445.  
  5446.         74
  5447.  
  5448.                                                    WBL FUNCTION REFERENCE
  5449.  
  5450.  
  5451.  
  5452.         If the program was not called, then an EXIT is assumed.
  5453.  
  5454.         Example:
  5455.           Display(2, "End of subroutine", "Returning to MAIN.WBT")
  5456.           Return
  5457.  
  5458.  
  5459.  
  5460.         Run
  5461.  
  5462.         Runs a program as a normal window.
  5463.  
  5464.         Syntax:
  5465.           Run (program-name, parameters)
  5466.  
  5467.         Parameters:
  5468.           "program-name" =the name of the desired .EXE, .COM, .PIF, .BAT
  5469.                     file, or a data file.
  5470.           "parameters" = optional parameters as required by the applica-
  5471.                     tion.
  5472.  
  5473.         Returns:
  5474.           (integer) @TRUE if the program was found;
  5475.                     @FALSE if it wasn't.
  5476.  
  5477.         Use this command to run an application.
  5478.  
  5479.         If the drive and path are not part of the program name, the
  5480.         current directory will be examined first and then the DOS path
  5481.         will be searched to find the desired executable file.
  5482.  
  5483.         If the "program-name" doesn't have an extension of .EXE, .COM,
  5484.         .PIF, or .BAT, it will be run in accordance with whatever is in
  5485.         the [extensions] section of the WIN.INI file.  When this happens,
  5486.         any "parameters" you specified are ignored.
  5487.  
  5488.         Examples:
  5489.           Run("notepad.exe", "abc.txt")
  5490.           Run("clock.exe", "")
  5491.           Run("paint.exe", "pict.msp")
  5492.  
  5493.         See Also:
  5494.           RunHide, RunIcon, RunZoom, WinClose, WinWaitClose
  5495.  
  5496.  
  5497.  
  5498.         RunHide
  5499.  
  5500.         Runs a program as a hidden window.
  5501.  
  5502.         Syntax:
  5503.           RunHide (program-name, parameters)
  5504.  
  5505.         Parameters:
  5506.           "program-name" =the name of the desired .EXE, .COM, .PIF, .BAT
  5507.                     file, or a data file.
  5508.           "parameters" = optional parameters as required by the
  5509.                     application.
  5510.  
  5511.  
  5512.  
  5513.  
  5514.                                                                        75
  5515.  
  5516.         WBL FUNCTION REFERENCE
  5517.  
  5518.  
  5519.  
  5520.         Returns:
  5521.           (integer) @TRUE if the program was found;
  5522.                     @FALSE if it wasn't.
  5523.  
  5524.         Use this command to run an application as a hidden window.
  5525.  
  5526.         If the drive and path are not part of the program name, the
  5527.         current directory will be examined first and then the DOS path
  5528.         will be searched to find the desired executable file.
  5529.  
  5530.         If the "program-name" doesn't have an extension of .EXE, .COM,
  5531.         .PIF, or .BAT, it will be run in accordance with whatever is in
  5532.         the [extensions] section of the WIN.INI file.  When this happens,
  5533.         any "parameters" you specified are ignored.
  5534.  
  5535.         Note:  When this command launches an application it informs it
  5536.         that you want it to run as a hidden window.  Whether or not the
  5537.         application honors your wish is beyond RunHide's control.
  5538.  
  5539.         Examples:
  5540.           RunHide("notepad.exe", "abc.txt")
  5541.           RunHide("clock.exe", "")
  5542.           RunHide("paint.exe", "pict.msp")
  5543.  
  5544.         See Also:
  5545.           Run, RunIcon, RunZoom, WinHide, WinClose, WinWaitClose
  5546.  
  5547.  
  5548.  
  5549.         RunIcon
  5550.  
  5551.         Runs a program as an iconic (minimized) window.
  5552.  
  5553.         Syntax:
  5554.           RunIcon (program-name, parameters)
  5555.  
  5556.         Parameters:
  5557.           "program-name" =the name of the desired .EXE, .COM, .PIF, .BAT
  5558.                     file, or a data file.
  5559.           "parameters" = optional parameters as required by the
  5560.                     application.
  5561.         Returns:
  5562.           (integer) @TRUE if the program was found;
  5563.                     @FALSE if it wasn't.
  5564.  
  5565.         Use this command to run an application as an icon.
  5566.  
  5567.         If the drive and path are not part of the program name, the
  5568.         current directory will be examined first and then the DOS path
  5569.         will be searched to find the desired executable file.
  5570.  
  5571.         If the "program-name" doesn't have an extension of .EXE, .COM,
  5572.         .PIF, or .BAT, it will be run in accordance with whatever is in
  5573.         the [extensions] section of the WIN.INI file.  When this happens,
  5574.         any "parameters" you specified are ignored.
  5575.  
  5576.  
  5577.  
  5578.  
  5579.  
  5580.  
  5581.         76
  5582.  
  5583.                                                    WBL FUNCTION REFERENCE
  5584.  
  5585.  
  5586.  
  5587.         Note:  When this command launches an application it merely
  5588.         informs it that you want it to begin as an icon.  Whether or not
  5589.         the application honors your wish is beyond RunIcon's control.
  5590.  
  5591.         Examples:
  5592.           RunIcon("notepad.exe", "abc.txt")
  5593.           RunIcon("clock.exe", "")
  5594.           RunIcon("paint.exe", "pict.msp")
  5595.  
  5596.         See Also:
  5597.           Run, RunHide, RunZoom, WinIconize, WinClose, WinWaitClose
  5598.  
  5599.  
  5600.  
  5601.         RunZoom
  5602.  
  5603.         Runs a program as a full-screen (maximized) window.
  5604.  
  5605.         Syntax:
  5606.           RunZoom (program-name, parameters)
  5607.  
  5608.         Parameters:
  5609.           "program-name" =the name of the desired .EXE, .COM, .PIF, .BAT
  5610.                     file, or a data file.
  5611.           "parameters" = optional parameters as required by the
  5612.                     application.
  5613.  
  5614.         Returns:
  5615.           (integer) @TRUE if the program was found;
  5616.                     @FALSE if it wasn't.
  5617.  
  5618.         Use this command to run an application as a full-screen window.
  5619.         If the drive and path are not part of the program name, the
  5620.         current directory will be examined first and then the DOS path
  5621.         will be searched to find the desired executable file.
  5622.  
  5623.         If the "program-name" doesn't have an extension of .EXE, .COM,
  5624.         .PIF, or .BAT, it will be run in accordance with whatever is in
  5625.         the [extensions] section of the WIN.INI file.  When this happens,
  5626.         any "parameters" you specified are ignored.
  5627.         Note:  When this command launches an application it merely
  5628.         informs it that you want it to be maximized to full-screen.
  5629.         Whether or not the application honors your wish is beyond
  5630.         RunZoom's control.
  5631.  
  5632.         Examples:
  5633.           RunZoom("notepad.exe", "abc.txt")
  5634.           RunZoom("clock.exe", "")
  5635.           RunZoom("paint.exe", "pict.msp")
  5636.  
  5637.         See Also:
  5638.           Run, RunHide, RunIcon, WinZoom, WinClose, WinWaitClose
  5639.  
  5640.  
  5641.  
  5642.  
  5643.  
  5644.  
  5645.                                                                        77
  5646.  
  5647.         WBL FUNCTION REFERENCE
  5648.  
  5649.  
  5650.  
  5651.         SendKey
  5652.  
  5653.         Sends keystrokes to the active application.
  5654.  
  5655.         Syntax:
  5656.           Sendkey (character-codes)
  5657.  
  5658.         Parameters:
  5659.           "character-codes" = string of regular and special characters
  5660.                     (see below).
  5661.         Returns:
  5662.           (integer) always 0
  5663.  
  5664.         SendKey is used to send keystrokes to the current window, just as
  5665.         if they had been entered from the keyboard.  Any alphanumeric
  5666.         character may be sent by simply placing the character in the
  5667.         string.  In addition, the following special characters may be
  5668.         used:
  5669.  
  5670.           Backspace {BACKSPACE} or {BS}
  5671.           Break     {BREAK}
  5672.           Clear     {CLEAR}
  5673.           Delete    {DELETE} or {DEL}
  5674.           Down Arrow   {DOWN}
  5675.           End       {END}
  5676.           ENTER     {ENTER} or ~
  5677.           Escape    {ESCAPE} or {ESC}
  5678.           F1 through F12 {F1} through {F12}
  5679.           Help      {HELP}
  5680.           Home      {HOME}
  5681.           Insert    {INSERT}
  5682.           Left Arrow   {LEFT}
  5683.           Page Down {PGDN}
  5684.           Page Up   {PGUP}
  5685.           Print Screen {PRTSC}
  5686.           Right Arrow  {RIGHT}
  5687.           Space     {SPACE} or {SP}
  5688.           Tab       {TAB}
  5689.           Up Arrow  {UP}
  5690.  
  5691.         To enter an Alt, Control, or Shift key combination, precede the
  5692.         desired key with one of the following symbols:
  5693.  
  5694.           Alt       !
  5695.           Control   ^
  5696.           Shift     +
  5697.  
  5698.         For example, to enter Alt-S:
  5699.  
  5700.           SendKey("!S").
  5701.  
  5702.         You may also repeat a key by following it with a space and then
  5703.         the total number of repetitions desired.
  5704.         For example, to move the cursor down 8 lines:
  5705.  
  5706.           SendKey("{DOWN} 8")
  5707.  
  5708.  
  5709.  
  5710.  
  5711.         78
  5712.  
  5713.                                                    WBL FUNCTION REFERENCE
  5714.  
  5715.  
  5716.  
  5717.  
  5718.  
  5719.         Example:
  5720.           ; Start Notepad.  Use *.* for filenames
  5721.           Run("Notepad.exe", "")
  5722.           SendKey("!FO*.*~")
  5723.  
  5724.         It is possible to use SendKey to send keystrokes to a DOS
  5725.         application, but only if you are running Windows in 386 Enhanced
  5726.         mode.  You transfer the keystrokes to the DOS application via the
  5727.         clipboard.  For example:
  5728.  
  5729.           ; run batch file which starts our editor
  5730.           run("edit.bat", "")
  5731.           ; wait 15 seconds for editor to load
  5732.           Delay(15)
  5733.           ; send Alt-F N to the clipboard
  5734.           ClipPut("!FN")
  5735.           ; paste contents of clipboard to DOS window
  5736.           SendKey("!{SP}EP")
  5737.  
  5738.         See Also:
  5739.           SKDebug
  5740.  
  5741.  
  5742.  
  5743.         SKDebug
  5744.  
  5745.         Controls how SendKey works
  5746.  
  5747.         Syntax:
  5748.           Skdebug(mode)
  5749.  
  5750.         Parameters:
  5751.           mode =    @OFF  Keystrokes sent to application.  No debug file
  5752.                     written.  Default mode.
  5753.                     @ON  Keystrokes sent to application.  Debug file
  5754.                     written.
  5755.                     @PARSEONLY  Keystrokes not sent to application.
  5756.                     Debug file written.
  5757.  
  5758.         Returns:
  5759.           (integer) previous SKDebug mode.
  5760.  
  5761.         Note: File C:\SKDEBUG.TXT contains parsed keystrokes
  5762.  
  5763.         Example:
  5764.           Run("notepad.exe", "")
  5765.           SKDebug(@ON)
  5766.           SendKey("!FO*.*~")
  5767.           SKDebug(@OFF)
  5768.  
  5769.         See Also:
  5770.           SendKey
  5771.  
  5772.  
  5773.  
  5774.  
  5775.  
  5776.  
  5777.                                                                        79
  5778.  
  5779.         WBL FUNCTION REFERENCE
  5780.  
  5781.  
  5782.  
  5783.         StrCat
  5784.  
  5785.         Concatenates two or more strings.
  5786.  
  5787.         Syntax:
  5788.           StrCat (string1, string2[, stringN]...)
  5789.  
  5790.         Parameters:
  5791.           "string1", etc =  at least two strings you want to "string"
  5792.                     together (so to speak).
  5793.  
  5794.         Returns:
  5795.           (string)  concatenation of the entire list of input strings.
  5796.  
  5797.         Use this command to stick character strings together, or to
  5798.         format display messages.
  5799.  
  5800.         Errors:
  5801.           2058 "StrCat function syntax error"
  5802.  
  5803.         Example:
  5804.           user = AskLine("Login", "Your Name:", "")
  5805.           Message("Login", StrCat("Hi, ", user))
  5806.           ; note that this will do the same:
  5807.           Message("Login", "Hi, %user%")
  5808.  
  5809.         See Also:
  5810.           StrFill, StrFix, StrTrim
  5811.  
  5812.  
  5813.  
  5814.         StrCmp
  5815.  
  5816.         Compares two strings.
  5817.  
  5818.         Syntax:
  5819.           StrCmp (string1, string2)
  5820.  
  5821.         Parameters:
  5822.           "string1", "string2" =
  5823.                     strings to compare.
  5824.  
  5825.         Returns:
  5826.           (integer) -1, 0, or 1; depending on whether string1 is less
  5827.                     than, equal to, or greater than string2,
  5828.                     respectively.
  5829.  
  5830.         Use this command to determine whether two strings are equal, or
  5831.         which precedes the other in an ASCII sorting sequence.
  5832.         Note:  This command has been included for semantic completeness.
  5833.         The relational operators >, >=, ==, !=, <=, and < provide the
  5834.         same capability.
  5835.  
  5836.  
  5837.  
  5838.  
  5839.  
  5840.  
  5841.  
  5842.  
  5843.  
  5844.         80
  5845.  
  5846.                                                    WBL FUNCTION REFERENCE
  5847.  
  5848.  
  5849.  
  5850.         Example:
  5851.           a = AskLine("STRCMP", "Enter a test line", "")
  5852.           b = AskLine("STRCMP", "Enter another test line", "")
  5853.           c = StrCmp(a, b)
  5854.           c = c + 1
  5855.           d = StrSub("less than   equal to    greater     than", c * 12,
  5856.             12)
  5857.           ; Note that above string is grouped into 12-character chunks.
  5858.           ; Desired chunk is removed with the StrSub statement.
  5859.           Message("STRCMP", "%a% is %d% %b%")
  5860.  
  5861.         See Also:
  5862.           StrICmp, StrIndex, StrLen, StrScan, StrSub
  5863.  
  5864.  
  5865.  
  5866.         StrFill
  5867.  
  5868.         Creates a string filled with a series of characters.
  5869.  
  5870.         Syntax:
  5871.           StrFill (filler, length)
  5872.  
  5873.         Parameters:
  5874.           "filler" =   a string to be repeated to create the return
  5875.                     string.  If the filler string is null, spaces will
  5876.                     be used instead.
  5877.           length =  the length of the desired string.
  5878.  
  5879.         Returns:
  5880.           (string)  character string.
  5881.  
  5882.         Use this function to create a string consisting of multiple
  5883.         copies of the filler string concatenated together.
  5884.  
  5885.         Example:
  5886.           Message("My Stars", StrFill("*", 30))
  5887.  
  5888.         See Also:
  5889.           StrCat, StrFix, StrLen, StrTrim
  5890.  
  5891.  
  5892.  
  5893.         StrFix
  5894.  
  5895.         Pads or truncates a string to a fixed length.
  5896.  
  5897.         Syntax:
  5898.           StrFix (base-string, pad-string, length)
  5899.  
  5900.         Parameters:
  5901.           "base-string" =   string to be adjusted to a fixed length.
  5902.           "pad-string" = appended to "base-string" if needed to fill out
  5903.                     the desired length.  If "pad-string" is null, spaces
  5904.                     are used instead.
  5905.  
  5906.  
  5907.  
  5908.  
  5909.                                                                        81
  5910.  
  5911.         WBL FUNCTION REFERENCE
  5912.  
  5913.  
  5914.  
  5915.           length =  length of the desired string.
  5916.  
  5917.         Returns:
  5918.           (string)  fixed size string.
  5919.  
  5920.         This function "fixes" the length of a string, either by
  5921.         truncating it on the right, or by appending enough copies of pad-
  5922.         string to achieve the desired length.
  5923.  
  5924.         Example:
  5925.           a = StrFix("Henry", " ", 15)
  5926.           b = StrFix("Betty", " ", 15)
  5927.           c = StrFix("George", " ", 15)
  5928.           Message("Spaced Names", StrCat(a, b, c))
  5929.  
  5930.         See Also:
  5931.           StrFill, StrLen, StrTrim
  5932.  
  5933.  
  5934.  
  5935.         StriCmp
  5936.  
  5937.         Compares two strings without regard to case.
  5938.  
  5939.         Syntax:
  5940.           StrICmp (string1, string2)
  5941.  
  5942.         Parameters:
  5943.           "string1", "string2" = strings to compare.
  5944.  
  5945.         Returns:
  5946.           (integer) -1, 0, or 1; depending on whether string1 is less
  5947.                     than, equal to, or greater than string2,
  5948.                     respectively.
  5949.  
  5950.         Use this command to determine whether two strings are equal, or
  5951.         which precedes the other in an ACSII sorting sequence, when case
  5952.         is ignored.
  5953.  
  5954.         Example:
  5955.           a = AskLine("STRICMP", "Enter a test line", "")
  5956.           b = AskLine("STRICMP", "Enter another test line", "")
  5957.           c = StriCmp(a, b)
  5958.           c = c + 1
  5959.           d = StrSub("less than   equal to    greater than", c * 12, 12)
  5960.           ; Note that above string is grouped into 12-character chunks.
  5961.           ; Desired chunk is removed with the StrSub statement.
  5962.           Message("STRICMP", "%a% is %d% %b%")
  5963.  
  5964.         See Also:
  5965.           StrCmp, StrIndex, StrLen, StrScan, StrSub
  5966.  
  5967.  
  5968.  
  5969.  
  5970.  
  5971.  
  5972.  
  5973.  
  5974.         82
  5975.  
  5976.                                                    WBL FUNCTION REFERENCE
  5977.  
  5978.  
  5979.  
  5980.         StrIndex
  5981.  
  5982.         Searches a string for a substring.
  5983.  
  5984.         Syntax:
  5985.           StrIndex (string, sub-string, start, direction)
  5986.  
  5987.         Parameters:
  5988.           "string" =   the string to be searched for a substring.
  5989.           "substring" =  the string to look for within the main string.
  5990.           start =   the position in the main string to begin the search.
  5991.                     The first character of a string is position 1.
  5992.           direction =  the search direction.  @FWDSCAN searches forward,
  5993.                     while @BACKSCAN searches backwards.
  5994.  
  5995.         Returns:
  5996.           (integer) position of "sub-string" within "string";
  5997.                     0 if not found.
  5998.  
  5999.         This function searches for a substring within a "target" string.
  6000.         Starting at the "start" position, it goes forward or backward
  6001.         depending on the value of the "direction" parameter.  It stops
  6002.         when it finds the "substring" within the "target" string, and
  6003.         returns its position.
  6004.  
  6005.         A start position of 0 has special meaning depending on which
  6006.         direction you are scanning.  For forward searches zero indicates
  6007.         the search should start at the beginning of the string.  For
  6008.         reverse searches zero causes it to start at the end of the
  6009.         string.
  6010.  
  6011.         Errors:
  6012.           3100 "StrIndex/StrScan 3rd parameter out of bounds"
  6013.  
  6014.         Example:
  6015.           instr = AskLine("STRINDEX", "Type a sentence:", "")
  6016.           start = 1
  6017.           end = StrIndex(InStr, " ", start, @FWDSCAN)
  6018.           If end == 0 Then Goto error
  6019.           Message("STRINDEX", StrCat("The first word is: ",
  6020.             StrSub(instr, start, end - 1))
  6021.           Exit
  6022.           :error
  6023.           Message("Sorry...", "No spaces found")
  6024.  
  6025.         See Also:
  6026.           StrLen, StrScan, StrSub
  6027.  
  6028.  
  6029.  
  6030.         StrLen
  6031.  
  6032.         Provides the length of a string.
  6033.  
  6034.         Syntax:
  6035.           StrLen (string)
  6036.  
  6037.  
  6038.  
  6039.  
  6040.  
  6041.                                                                        83
  6042.  
  6043.         WBL FUNCTION REFERENCE
  6044.  
  6045.  
  6046.  
  6047.         Parameters:
  6048.           "string" =   any text string.
  6049.  
  6050.         Returns:
  6051.           (integer) length of string.
  6052.  
  6053.         Use this command to determine the length of a string variable or
  6054.         expression.
  6055.  
  6056.         Example:
  6057.           myfile = AskLine("Filename", "File to process:", "")
  6058.           namlen = StrLen(myfile)
  6059.           If namlen > 13 Then Message("", "Filename too long!")
  6060.  
  6061.         See Also:
  6062.           StrFill, StrFix, StrIndex, StrScan, StrTrim
  6063.  
  6064.  
  6065.  
  6066.         StrLower
  6067.  
  6068.         Converts a string to lowercase.
  6069.  
  6070.         Syntax:
  6071.           StrLower (string)
  6072.  
  6073.         Parameters:
  6074.           "string" =   any text string.
  6075.  
  6076.         Returns:
  6077.           (string)  lowercase string.
  6078.  
  6079.         Use this command to convert a text string to lower case.
  6080.  
  6081.         Example:
  6082.           a = AskLine("STRLOWER", "Enter text", "")
  6083.           b = strlower(a)
  6084.           message(a, b)
  6085.  
  6086.         See Also:
  6087.           StrICmp, StrUpper
  6088.  
  6089.  
  6090.  
  6091.         StrReplace
  6092.  
  6093.         Replaces all occurances of a substring with another.
  6094.  
  6095.         Syntax:
  6096.           StrReplace (string, old, new)
  6097.  
  6098.         Parameters:
  6099.           "string" =   string in which to search.
  6100.           "old" =   target substring.
  6101.           "new" =   replacement substring.
  6102.  
  6103.  
  6104.  
  6105.  
  6106.  
  6107.         84
  6108.  
  6109.                                                    WBL FUNCTION REFERENCE
  6110.  
  6111.  
  6112.  
  6113.         StrReplace scans the 'string', searching for occurrences of 'old'
  6114.         and replacing each occurrence with 'new'.  'String' is modified
  6115.         directly.
  6116.  
  6117.         Example:
  6118.           ; Copy highlighted files to clipboard
  6119.           a = FileItemize("")
  6120.           crlf = StrCat(Num2Char(13), Num2Char(10))
  6121.           StrReplace(a, " ", crlf)
  6122.           ClipPut(a)
  6123.  
  6124.  
  6125.  
  6126.         StrScan
  6127.  
  6128.         Searches string for occurrence of delimiters.
  6129.  
  6130.         Syntax:
  6131.           StrScan (string, delimiters, start, direction)
  6132.  
  6133.         Parameters:
  6134.           "string" =   the string that is to be searched.
  6135.           "delimiters" = a string of delimiters to search for within
  6136.                     "string".
  6137.           start =   the position in the main string to begin the search.
  6138.                     The first character of a string is  position 1.
  6139.           direction =  the search direction.  @FWDSCAN searches forward,
  6140.                     while @BACKSCAN searches backwards.
  6141.  
  6142.         Returns:
  6143.           (integer) position of delimiter in string, or 0 if not found.
  6144.  
  6145.         This function searches for delimiters within a target "string".
  6146.         Starting at the "start" position, it goes forward or backward
  6147.         depending on the value of the "direction" parameter.  It stops
  6148.         when it finds any one of the characters in the "delimiters"
  6149.         string within the target "string".
  6150.  
  6151.         Errors:
  6152.           3100 "StrIndex/StrScan 3rd parameter out of bounds"
  6153.  
  6154.         Example:
  6155.           thestr = "123,456.789:abc"
  6156.           start = 1
  6157.           end = StrScan(thestr, ",.:", start, @FWDSCAN)
  6158.           If end == 0 Then Goto error
  6159.           Message("The first parameter", StrSub(thestr, start, end -
  6160.             start + 1))
  6161.           Exit
  6162.           :error
  6163.           Message("Sorry...", "No delimiters found")
  6164.  
  6165.         See Also:
  6166.           StrLen, StrSub
  6167.  
  6168.  
  6169.  
  6170.  
  6171.  
  6172.  
  6173.                                                                        85
  6174.  
  6175.         WBL FUNCTION REFERENCE
  6176.  
  6177.  
  6178.  
  6179.         StrSub
  6180.  
  6181.         Extracts a substring out of an existing string.
  6182.  
  6183.         Syntax:
  6184.           StrSub (string, start, length)
  6185.  
  6186.         Parameters:
  6187.           "string" =   the string from which the substring is to be
  6188.                     extracted.
  6189.           start =   character position within "string" where the sub-
  6190.                     string starts.  (The first character of the string
  6191.                     is at position 1).
  6192.           length =  length of desired substring.  If you specify a
  6193.                     length of zero it will return a null string.
  6194.  
  6195.         Returns:
  6196.           (string)  substring of parameter string.
  6197.  
  6198.         This function extracts a substring from within a "target" string.
  6199.         Starting at the "start" position, it copies up to "length"
  6200.         characters into the substring.
  6201.  
  6202.         Errors:
  6203.           3059 "Illegal Bounds for STRSUB function"
  6204.  
  6205.         Example:
  6206.           a = "My dog has fleas"
  6207.           animal = StrSub(a, 4, 3)
  6208.           Message("STRSUB", "My animal is a %animal%")
  6209.  
  6210.         See Also:
  6211.           StrLen, StrScan
  6212.  
  6213.  
  6214.  
  6215.         StrTrim
  6216.  
  6217.         Removes leading and trailing spaces from a character string.
  6218.  
  6219.         Syntax:
  6220.           StrTrim (string)
  6221.  
  6222.         Parameters:
  6223.           "string" =   a string with unwanted spaces at the beginning
  6224.                     and/or the end.
  6225.  
  6226.         Returns:
  6227.           (string)  string devoid of leading and trailing spaces.
  6228.  
  6229.         Use this function to remove unwanted spaces from the beginning
  6230.         and end of text data.
  6231.  
  6232.  
  6233.  
  6234.  
  6235.  
  6236.  
  6237.  
  6238.  
  6239.  
  6240.         86
  6241.  
  6242.                                                    WBL FUNCTION REFERENCE
  6243.  
  6244.  
  6245.  
  6246.         Example:
  6247.           thefile = AskLine("STRTRIM", "Filename ('exit' cancels)", "")
  6248.           tstexit = StrTrim(StrLower(thefile))
  6249.           If tstexit == "exit" Then Goto cancel
  6250.           ; processing of thefile continues...
  6251.           : cancel
  6252.           Message("Canceled", "...by user request")
  6253.  
  6254.         See Also:
  6255.           StrFill, StrFix, StrLen
  6256.  
  6257.  
  6258.  
  6259.         StrUpper
  6260.  
  6261.         Converts a string to uppercase.
  6262.  
  6263.         Syntax:
  6264.           StrUpper (string)
  6265.  
  6266.         Parameters:
  6267.           "string" =   any text string.
  6268.  
  6269.         Returns:
  6270.           (string)  uppercase string.
  6271.  
  6272.         Use this function to convert a text string to upper case.
  6273.  
  6274.         Example:
  6275.           a = AskLine("STRUPPER", "Enter text","")
  6276.           b = StrUpper(a)
  6277.           message(a, b)
  6278.  
  6279.         See Also:
  6280.           StrICmp, StrLower
  6281.  
  6282.  
  6283.  
  6284.         TextBox
  6285.  
  6286.         Displays a file in a listbox on the screen and returns selected
  6287.         line, if any.
  6288.  
  6289.         Syntax:
  6290.           TextBox (title, filename)
  6291.  
  6292.         Parameters:
  6293.           "title" = listbox title.
  6294.           "filename" = file containing contents of listbox.
  6295.  
  6296.         Returns:
  6297.           (string) =   highlighted string, if any.
  6298.  
  6299.         The TextBox command loads a file into a Windows listbox and
  6300.         displays the listbox to the user.  The command has two primary
  6301.         uses:  First off, it can be used to display multi-line messages
  6302.  
  6303.  
  6304.  
  6305.  
  6306.                                                                        87
  6307.  
  6308.         WBL FUNCTION REFERENCE
  6309.  
  6310.  
  6311.  
  6312.         to the user.  In addition, because of its ability to return a
  6313.         selected line, it may be used as a multiple choice question box.
  6314.         The line highlighted by the user (if any) will be returned to the
  6315.         program.
  6316.  
  6317.         If disk drive and path not are part of the filename,  the current
  6318.         directory will be examined first, and then the DOS path will be
  6319.         searched to find the desired file.
  6320.  
  6321.         Example:
  6322.           ; Display config.sys
  6323.           a = TextBox("Choose a line", "C:\CONFIG.SYS")
  6324.           Display(3, "Chosen line", a)
  6325.  
  6326.         See Also:
  6327.           ItemSelect
  6328.  
  6329.  
  6330.  
  6331.         Version
  6332.  
  6333.         Returns the version number of the currently-running WinBatch
  6334.         language processor.
  6335.  
  6336.         Syntax:
  6337.           Version ( )
  6338.  
  6339.         Returns:
  6340.           (string) =   WinBatch version number.
  6341.  
  6342.         Use this function to determine the version of WinBatch that is
  6343.         running.  It is useful to verify that a batch file generated with
  6344.         the latest version of the language will operate properly on what
  6345.         may be a different machine with a different version of WinBatch
  6346.         installed.
  6347.  
  6348.         Example:
  6349.           a = Version()
  6350.  
  6351.         See Also:
  6352.           Environment, WinVersion
  6353.  
  6354.  
  6355.  
  6356.         WinActivate
  6357.  
  6358.         Activates a previously running window.
  6359.  
  6360.         Syntax:
  6361.           WinActivate (partial-windowname)
  6362.  
  6363.         Parameters:
  6364.           "partial-windowname" =
  6365.                     either an initial portion of, or an entire window
  6366.                     name.  The most-recently used window whose title
  6367.                     matches the name will be activated.
  6368.  
  6369.  
  6370.  
  6371.  
  6372.         88
  6373.  
  6374.                                                    WBL FUNCTION REFERENCE
  6375.  
  6376.  
  6377.  
  6378.         Returns:
  6379.           (integer) @TRUE if a window was found to activate;
  6380.                     @FALSE if no windows were found.
  6381.  
  6382.         Use this command to activate windows for user input.
  6383.  
  6384.         Errors:
  6385.           1045 "WinActivate: Window not found"
  6386.  
  6387.         Example:
  6388.           Run("notepad.exe", "")
  6389.           Run("clock.exe", "")
  6390.           WinActivate("Notepad")
  6391.  
  6392.         See Also:
  6393.           WinCloseNot, WinGetActive, WinShow
  6394.  
  6395.  
  6396.  
  6397.         WinArrange
  6398.  
  6399.         Arranges, tiles, and/or stacks application windows.
  6400.  
  6401.         Syntax:
  6402.           WinArrange (style)
  6403.  
  6404.         Parameters:
  6405.           style =   one of the following:  @STACK, @TILE (or @ARRANGE),
  6406.                     @ROWS, or @COLUMNS.
  6407.         Returns:
  6408.           (integer) always @TRUE.
  6409.  
  6410.         Use this command to rearrange the open windows on the screen.
  6411.         (Any iconized programs are unaffected.)
  6412.  
  6413.         When you specify @ROWS and you have more than four open windows,
  6414.         or if you specify @COLUMNS and you have more than three open
  6415.         windows, WinBatch will revert to @TILE.
  6416.  
  6417.         Example:
  6418.           ; Reveal all windows
  6419.           WinArrange(@TILE)
  6420.  
  6421.         See Also:
  6422.           WinItemize, WinHide, WinIconize, WinPlace, WinShow, WinZoom
  6423.  
  6424.  
  6425.  
  6426.         WinClose
  6427.  
  6428.         Closes an open window.
  6429.  
  6430.         Syntax:
  6431.           WinClose (partial-windowname)
  6432.  
  6433.  
  6434.  
  6435.  
  6436.  
  6437.                                                                        89
  6438.  
  6439.         WBL FUNCTION REFERENCE
  6440.  
  6441.  
  6442.  
  6443.         Parameters:
  6444.           "partial-windowname" =
  6445.                     either an initial portion of, or an entire window
  6446.                     name.  The most-recently used window whose title
  6447.                     matches the name will be closed.
  6448.  
  6449.         Returns:
  6450.           (integer) @TRUE if a window was found to close;
  6451.                     @FALSE if no windows were found.
  6452.  
  6453.         Use this command to close windows.
  6454.         This command will not close the current WinBatch window.  You
  6455.         can, however, call EndSession to end the current Windows session.
  6456.  
  6457.         Errors:
  6458.           1039 "WinClose: Window not found"
  6459.  
  6460.         Example:
  6461.           Run("notepad.exe", "")
  6462.           WinClose("Notepad")
  6463.  
  6464.         See Also:
  6465.           WinCloseNot, WinHide, WinIconize, WinWaitClose
  6466.  
  6467.  
  6468.  
  6469.         WinCloseNot
  6470.  
  6471.         Closes all windows, except those provided as parameters:.
  6472.  
  6473.         Syntax:
  6474.           WinCloseNot (partial-windowname [, partial-windowname]...)
  6475.  
  6476.         Parameters:
  6477.           "partial-windowname" =
  6478.                     either an initial portion of, or an entire window
  6479.                     name.  Any windows whose titles match the partial
  6480.                     names will stay open.
  6481.  
  6482.         Returns:
  6483.           (integer) always @TRUE.
  6484.  
  6485.         Use this command to close all windows except those specifically
  6486.         listed in the parameter strings.
  6487.  
  6488.         At least one partial windowname must be given.  A null-string
  6489.         parameter would match all windows, or in other words close
  6490.         nothing.
  6491.  
  6492.  
  6493.  
  6494.  
  6495.  
  6496.  
  6497.  
  6498.  
  6499.  
  6500.  
  6501.  
  6502.  
  6503.         90
  6504.  
  6505.                                                    WBL FUNCTION REFERENCE
  6506.  
  6507.  
  6508.  
  6509.         Errors:
  6510.           2038 "WinCloseNot Function Syntax error"
  6511.  
  6512.         Example:
  6513.           ; The statement below will close all windows except:
  6514.           ; 1) MS-DOS Executive (starts with 'MS-D')
  6515.           ; 2) Clock  (starts with 'Clo' )
  6516.           WinCloseNot("MS-D", "Clo")
  6517.  
  6518.         See Also:
  6519.           WinItemize, WinClose, WinHide, WinIconize, WinWaitClose
  6520.  
  6521.  
  6522.  
  6523.         WinConfig
  6524.  
  6525.         Returns WIN3 mode flags.
  6526.  
  6527.         Syntax:
  6528.           WinConfig ()
  6529.  
  6530.  
  6531.         Returns the Windows configuration information as a number.  Bits
  6532.         are defined as follows:
  6533.  
  6534.           1     Protected Mode
  6535.           2     80286 CPU
  6536.           4     80386 CPU
  6537.           8     80486 CPU
  6538.           16    Standard Mode
  6539.           32    Enhanced Mode
  6540.           64    8086 CPU
  6541.           128   80186 CPU
  6542.           256   Large PageFrame
  6543.           512   Small PageFrame
  6544.           1024  80x87 Installed
  6545.  
  6546.  
  6547.  
  6548.         WinExist
  6549.  
  6550.         Tells if Window exists.
  6551.  
  6552.         Syntax:
  6553.           WinExist (partialwindowname)
  6554.  
  6555.         Parameters:
  6556.           "partial-windowname" =
  6557.                     either an initial portion of, or an entire window
  6558.                     name.
  6559.  
  6560.         Returns:
  6561.           (integer) @TRUE if a matching window is found.
  6562.                     @FALSE if a matching window is not found.
  6563.  
  6564.         Note: The partial window name you give must match the initial
  6565.         portion of the window name (as appears in the title bar) exactly,
  6566.         including proper case (upper or lower) and punctuation.
  6567.  
  6568.  
  6569.  
  6570.  
  6571.                                                                        91
  6572.  
  6573.         WBL FUNCTION REFERENCE
  6574.  
  6575.  
  6576.  
  6577.         Example:
  6578.           If WinExist("Clock") == @FALSE Then RunIcon("Clock", "")
  6579.  
  6580.  
  6581.  
  6582.         WinGetActive
  6583.  
  6584.         Gets the title of the active window.
  6585.  
  6586.         Syntax:
  6587.           WinGetActive ( )
  6588.  
  6589.         Returns:
  6590.           (string)  title of active window.
  6591.  
  6592.         Use this command to determine which window is currently active.
  6593.  
  6594.         Example:
  6595.           currentwin = WinGetActive()
  6596.  
  6597.         See Also:
  6598.           WinItemize, WinActivate
  6599.  
  6600.  
  6601.  
  6602.         WinHide
  6603.  
  6604.         Hides a window.
  6605.  
  6606.         Syntax:
  6607.           WinHide (partial-windowname)
  6608.  
  6609.         Parameters:
  6610.           "partial-windowname" =
  6611.                     either an initial portion of, or an entire window
  6612.                     name.  The most-recently used window whose title
  6613.                     matches the name will be hidden.
  6614.  
  6615.         Returns:
  6616.           (integer) @TRUE if a window was found to hide;
  6617.                     @FALSE if no windows were found.
  6618.  
  6619.         Use this command to hide windows.  The programs are still running
  6620.         when they are hidden.
  6621.  
  6622.         A partial-windowname of "" hides the current WinBatch window.
  6623.  
  6624.         Errors:
  6625.           1040 "WinHide: Window not found"
  6626.  
  6627.         Example:
  6628.           Run("notepad.exe", "")
  6629.           WinHide("Notepad")
  6630.           WinShow("Notepad")
  6631.  
  6632.         See Also:
  6633.           WinClose, WinIconize, WinPlace
  6634.  
  6635.  
  6636.  
  6637.  
  6638.         92
  6639.  
  6640.                                                    WBL FUNCTION REFERENCE
  6641.  
  6642.  
  6643.  
  6644.         WinIconize
  6645.  
  6646.         Iconizes a window.
  6647.  
  6648.         Syntax:
  6649.           WinIconize (partial-windowname)
  6650.  
  6651.         Parameters:
  6652.           "partial-windowname" =
  6653.                     either an initial portion of, or an entire window
  6654.                     name.  The most-recently used window whose title
  6655.                     matches the name will be iconized.
  6656.  
  6657.         Returns:
  6658.           (integer) @TRUE if a window was found to iconize;
  6659.                     @FALSE if no windows were found.
  6660.  
  6661.         Use this command to turn a window into an icon at the bottom of
  6662.         the screen.
  6663.  
  6664.         A partial-windowname of "" iconizes the current WinBatch window.
  6665.  
  6666.         Errors:
  6667.           1041 "WinIconize: Window not found"
  6668.  
  6669.         Example:
  6670.           Run("clock.exe", "")
  6671.           WinIconize("Clo")   ; partial window name used here
  6672.  
  6673.         See Also:
  6674.           WinClose, WinHide, WinPlace, WinShow, WinZoom
  6675.  
  6676.  
  6677.  
  6678.         WinItemize
  6679.  
  6680.         Returns a tab-delimited list of all open windows.
  6681.  
  6682.         Syntax:
  6683.           WinItemize ( )
  6684.  
  6685.         Returns:
  6686.           (string)  list of all open windows' titles.
  6687.  
  6688.         This function compiles a list of all the open application
  6689.         windows' titles and separates the titles by tabs.  This is
  6690.         especially useful in conjunction with the ItemSelect function,
  6691.         which enables the user to choose an item from such a tab-
  6692.         delimited list.
  6693.  
  6694.         Note this behaves somewhat differently than FileItemize and
  6695.         DirItemize, which create space-delimited lists.  This is because
  6696.         window titles regularly contain embedded spaces.
  6697.  
  6698.  
  6699.  
  6700.  
  6701.  
  6702.  
  6703.  
  6704.  
  6705.  
  6706.                                                                        93
  6707.  
  6708.         WBL FUNCTION REFERENCE
  6709.  
  6710.  
  6711.  
  6712.         Example:
  6713.           ; Find a window
  6714.           allwins = WinItemize()
  6715.           htab = Num2Char(9)
  6716.           mywind = ItemSelect("Windows", allwins, htab)
  6717.           WinActivate(mywind)
  6718.  
  6719.         See Also:
  6720.           DirItemize, FileItemize, ItemSelect
  6721.  
  6722.  
  6723.  
  6724.         WinPlace
  6725.  
  6726.         Places a window anywhere on the screen.
  6727.  
  6728.         Syntax:
  6729.           WinPlace (x-ulc, y-ulc, x-brc, y-brc, partial-windowname)
  6730.  
  6731.         Parameters:
  6732.           x-ulc =   how far from the left of the screen to place the
  6733.                     upper-left corner (0-1000).
  6734.           y-ulc =   how far from the top of the screen to place the
  6735.                     upper-left corner (0-1000).
  6736.           x-brc =   how far from the left of the screen to place the
  6737.                     bottom-right corner (10-1000) or @NORESIZE.
  6738.           y-brc =   how far from the top of the screen to place the
  6739.                     bottom-right corner (10-1000) or @NORESIZE or
  6740.                     @ABOVEICONS.
  6741.           "partial-windowname" =
  6742.                     either an initial portion of, or an entire window
  6743.                     name.  The most-recently used window whose title
  6744.                     matches the name will be moved to the new position.
  6745.  
  6746.         Returns:
  6747.           (integer) @TRUE if a window was found to move;
  6748.                     @FALSE if no windows were found.
  6749.  
  6750.         Use this command to move windows on the screen.  (You cannot,
  6751.         however, move icons or windows that have been maximized to full
  6752.         screen.)
  6753.  
  6754.         The "x-ulc", "y-ulc", "x-brc", and "y-brc" parameters are based
  6755.         on a logical screen that is 1000 points wide by 1000 points high.
  6756.  
  6757.         You can move the window without changing the width and/or height
  6758.         by specifying @NORESIZE for the "x-brc" and/or "y-brc"
  6759.         parameters, respectively.
  6760.  
  6761.         You can fix the bottom of the window to sit just above the line
  6762.         of icons along the bottom of the screen by specifying a "y-brc"
  6763.         of @ABOVEICONS.
  6764.  
  6765.         Some sample parameters:
  6766.  
  6767.           Upper left quarter of the screen:  0, 0, 500, 500
  6768.           Upper right quarter:  500, 0, 500, 1000
  6769.  
  6770.  
  6771.  
  6772.  
  6773.  
  6774.         94
  6775.  
  6776.                                                    WBL FUNCTION REFERENCE
  6777.  
  6778.  
  6779.  
  6780.           Center quarter:  250, 250, 750, 750
  6781.           Lower left eighth:  0, 750, 500, 1000
  6782.  
  6783.         A handy utility program is included with WinBatch, called
  6784.         WinInfo.exe.  This program lets you take an open window that is
  6785.         sized and positioned the way you like it, and automatically
  6786.         create the proper WinPlace statement for you.  It puts the text
  6787.         into the Clipboard, from which you can paste it into your batch
  6788.         code:
  6789.  
  6790.         You'll need a mouse to use WinInfo.  While WinInfo is the active
  6791.         window, place the mouse over the window you wish to create the
  6792.         WinPlace statement for, and press the spacebar.  The new
  6793.         statement will be placed into the Clipboard.  Then press the Esc
  6794.         key to close WinInfo.
  6795.  
  6796.         Errors:
  6797.           1044 "WinPlace: Window not found"
  6798.  
  6799.         Example:
  6800.           WinPlace(0, 0, 200, 200, "Clock")
  6801.  
  6802.         See Also:
  6803.           WinArrange, WinHide, WinIconize, WinShow, WinZoom
  6804.  
  6805.  
  6806.  
  6807.         WinPosition
  6808.  
  6809.         Returns Window position.
  6810.  
  6811.         Syntax:
  6812.           WinPosition (partialwindowname)
  6813.  
  6814.         Parameters:
  6815.           "partial-windowname" =
  6816.                     either an initial portion of, or an entire window
  6817.                     name.
  6818.  
  6819.         Returns:
  6820.           (string)  window coordinates, delimited by commas.
  6821.  
  6822.         Returns the current Window position information for the selected
  6823.         Window.  It returns 4 comma-separated numbers (see WinPlace for
  6824.         details).
  6825.  
  6826.         Example:
  6827.           a = WinPosition("Clock")
  6828.  
  6829.         A return value for the above function might be "0,0,100,100".
  6830.  
  6831.         See Also:
  6832.           WinPlace
  6833.  
  6834.  
  6835.  
  6836.  
  6837.  
  6838.  
  6839.  
  6840.                                                                        95
  6841.  
  6842.         WBL FUNCTION REFERENCE
  6843.  
  6844.  
  6845.  
  6846.         WinShow
  6847.  
  6848.         Shows a window in its "normal" state.
  6849.  
  6850.         Syntax:
  6851.           WinShow (partial-windowname)
  6852.  
  6853.         Parameters:
  6854.           "partial-windowname" =
  6855.                     either an initial portion of, or an entire window
  6856.                     name.  The most-recently used window whose title
  6857.                     matches the name will be shown.
  6858.  
  6859.         Returns:
  6860.           (integer) @TRUE if a window was found to show;
  6861.                     @FALSE if no windows were found.
  6862.  
  6863.         Use this command to restore a window to its "normal" size and
  6864.         position.
  6865.  
  6866.         A partial-windowname of "" restores the current WinBatch window.
  6867.  
  6868.         Errors:
  6869.           1043 "WinShow: Window not found"
  6870.  
  6871.         Example:
  6872.           RunZoom("notepad.exe", "")
  6873.           ; other processing...
  6874.           WinShow("Notepad")
  6875.  
  6876.         See Also:
  6877.           WinArrange, WinHide, WinIconize, WinZoom
  6878.  
  6879.  
  6880.  
  6881.         WinTitle
  6882.  
  6883.         Changes the title of a window.
  6884.  
  6885.         Syntax:
  6886.           WinTitle (partial-windowname, new-name)
  6887.  
  6888.         Parameters:
  6889.           "partial-windowname" =
  6890.                     either an initial portion of, or an entire window
  6891.                     name.  The most-recently used window whose title
  6892.                     matches the name will be shown.
  6893.           "new-name" = the new name of the window.
  6894.  
  6895.         Returns:
  6896.           (integer) @TRUE if a window was found to rename;
  6897.                     @FALSE if no windows were found.
  6898.  
  6899.         Use this command to change a window's title.
  6900.  
  6901.         A partial-windowname of "" refers to the current WinBatch window.
  6902.  
  6903.  
  6904.  
  6905.  
  6906.  
  6907.  
  6908.         96
  6909.  
  6910.                                                    WBL FUNCTION REFERENCE
  6911.  
  6912.  
  6913.  
  6914.         Note:  Some applications may rely upon their window's title
  6915.         staying the same!  It should be used with caution and adequate
  6916.         testing.
  6917.  
  6918.         Example:
  6919.           ; Capitalize title of window
  6920.           htab = Num2Char(9)
  6921.           allwinds = WinItemize()
  6922.           MyWin = ItemSelect("Uppercase Windows", allwinds, htab)
  6923.           WinTitle(mywin, StrUpper(mywin))
  6924.           Drop(htab, allwinds, mywin)
  6925.  
  6926.         See Also:
  6927.           WinItemize
  6928.  
  6929.  
  6930.  
  6931.         WinVersion
  6932.  
  6933.         Provides the version number of the current Windows system.
  6934.  
  6935.         Syntax:
  6936.           WinVersion (level)
  6937.  
  6938.         Parameters:
  6939.           level =   either @MAJOR or @MINOR.
  6940.  
  6941.         Returns:
  6942.           (integer) either major or minor part of the Windows version
  6943.                     number.
  6944.  
  6945.         Use this command to determine which version of Windows is
  6946.         currently running.
  6947.  
  6948.         @MAJOR returns the integer part of the Windows version number;
  6949.         i.e. 1.0, 2.11, 3.0, etc.
  6950.  
  6951.         @MINOR returns the decimal part of the Windows version number;
  6952.         i.e. 1.0, 2.11, 3.0, etc.
  6953.  
  6954.         Example:
  6955.           minorver = WinVersion(@MINOR)
  6956.           majorver = WinVersion(@MAJOR)
  6957.           Message("Windows Version", StrCat(majorver, ".", minorver))
  6958.  
  6959.         See Also:
  6960.           Version
  6961.  
  6962.  
  6963.  
  6964.         WinWaitClose
  6965.  
  6966.         Suspends the batch file execution until a specified window has
  6967.         been closed.
  6968.  
  6969.  
  6970.  
  6971.  
  6972.  
  6973.  
  6974.                                                                        97
  6975.  
  6976.         WBL FUNCTION REFERENCE
  6977.  
  6978.  
  6979.  
  6980.         Syntax:
  6981.           WinWaitClose (partial-windowname)
  6982.  
  6983.         Parameters:
  6984.           "partial-windowname" =
  6985.                     either an initial portion of, or an entire window
  6986.                     name.  WinWaitClose suspends execution until all
  6987.                     matching windows have been closed.
  6988.  
  6989.         Returns:
  6990.           (integer) @TRUE if at least one window was found to wait for;
  6991.                     @FALSE if no windows were found.
  6992.  
  6993.         Use this command to suspend the batch file's execution until the
  6994.         user has finished using a given window and has manually closed
  6995.         it.
  6996.  
  6997.         Example:
  6998.           Run("clock.exe", "")
  6999.           Display(4, "Note", "Close Clock to continue")
  7000.           WinWaitClose("Clock")
  7001.           Message("Continuing...", "Clock closed")
  7002.  
  7003.         See Also:
  7004.           Delay, Yield
  7005.  
  7006.  
  7007.  
  7008.         WinZoom
  7009.  
  7010.         Maximizes a window to full-screen.
  7011.  
  7012.         Syntax:
  7013.           WinZoom (partial-windowname)
  7014.  
  7015.         Parameters:
  7016.           "partial-windowname" =
  7017.                     either an initial portion of, or an entire window
  7018.                     name.  The most-recently used window whose title
  7019.                     matches the name will be shown.
  7020.  
  7021.         Returns:
  7022.           (integer) @TRUE if a window was found to zoom;
  7023.                     @FALSE if no windows were found.
  7024.  
  7025.         Use this command to "zoom" windows to full screen size.
  7026.         A partial-windowname of "" zooms the current WinBatch window.
  7027.  
  7028.         Errors:
  7029.           1042 "WinZoom: Window not found"
  7030.  
  7031.         Example:
  7032.           Run("notepad.exe", "")
  7033.           WinZoom("Notepad")
  7034.           WinShow("Notepad")
  7035.  
  7036.  
  7037.  
  7038.  
  7039.  
  7040.         98
  7041.  
  7042.                                                    WBL FUNCTION REFERENCE
  7043.  
  7044.  
  7045.  
  7046.         See Also:
  7047.           WinHide, WinIconize, WinPlace, WinShow
  7048.  
  7049.  
  7050.  
  7051.         Yield
  7052.  
  7053.         Provides time for other windows to do processing.
  7054.  
  7055.         Syntax:
  7056.           Yield
  7057.  
  7058.         Use this command to give other running windows time to process.
  7059.         This command will allow each open window to process 20 or more
  7060.         messages.
  7061.  
  7062.         Example:
  7063.           ;run Excel and give it some time to start up...
  7064.           sheet = AskLine ("Excel", "File to run:", "")
  7065.           run("Excel.exe", sheet)
  7066.           yield
  7067.           yield
  7068.           yield
  7069.  
  7070.         See Also:
  7071.           Delay
  7072.  
  7073.  
  7074.  
  7075.  
  7076.  
  7077.  
  7078.  
  7079.  
  7080.  
  7081.  
  7082.  
  7083.  
  7084.  
  7085.  
  7086.  
  7087.  
  7088.  
  7089.  
  7090.  
  7091.  
  7092.  
  7093.  
  7094.  
  7095.  
  7096.  
  7097.  
  7098.  
  7099.  
  7100.  
  7101.  
  7102.                                                                        99
  7103.  
  7104.         APPENDIX A    Predefined Constants
  7105.  
  7106.  
  7107.  
  7108.  
  7109.                                    APPENDIX A
  7110.  
  7111.                               Predefined Constants
  7112.  
  7113.         WBL provides you with a number of predefined integer constants to
  7114.         help make your batch files more mnemonic:
  7115.  
  7116.         Logical Conditions               String Handling
  7117.  
  7118.         @FALSE                           @FWDSCAN
  7119.         @NO                              @BACKSCAN
  7120.         @OFF
  7121.         @TRUE                            Menu Handling
  7122.         @YES
  7123.         @ON                              @ENABLE
  7124.                                          @DISABLE
  7125.         Window Arranging                 @UNCHECK
  7126.                                          @CHECK
  7127.         @NORESIZE
  7128.         @ABOVEICONS                      System Control
  7129.         @STACK
  7130.         @ARRANGE                         @MAJOR
  7131.         @TITLE                           @MINOR
  7132.         @ROWS
  7133.         @COLUMNS                         Error Handling
  7134.  
  7135.                                          @CANCEL
  7136.                                          @NOTIFY
  7137.                                          @OFF
  7138.  
  7139.                                          Keyboard Status
  7140.  
  7141.                                          @SHIFT
  7142.                                          @CTRL
  7143.  
  7144.  
  7145.  
  7146.  
  7147.  
  7148.  
  7149.  
  7150.  
  7151.  
  7152.  
  7153.  
  7154.  
  7155.  
  7156.  
  7157.  
  7158.  
  7159.  
  7160.  
  7161.  
  7162.  
  7163.  
  7164.  
  7165.  
  7166.  
  7167.  
  7168.         100
  7169.  
  7170.                                                      APPENDIX B    Errors
  7171.  
  7172.  
  7173.  
  7174.  
  7175.                                    APPENDIX B
  7176.  
  7177.                                      Errors
  7178.  
  7179.         If the current error mode is @CANCEL (the default), any WBL
  7180.         errors encountered while processing a batch file cause the item
  7181.         to be canceled with an error message.
  7182.  
  7183.  
  7184.         Minor Errors
  7185.  
  7186.         Minor errors are ignored if the current error mode has been set
  7187.         to @OFF.  If the error mode is @NOTIFY the user has the option of
  7188.         continuing with the batch file or canceling it.
  7189.  
  7190.         1006 File Copy/Move: No matching files found
  7191.         1017 File Delete: No matching files found
  7192.         1018 File Delete: Delete Failed
  7193.         1024 File Rename: No matching files found
  7194.         1025 File Rename: Rename failed
  7195.         1028 LogDisk: Requested drive not online
  7196.         1029 DirMake: Dir not created
  7197.         1030 DirRemove: Dir not removed
  7198.         1031 DirChange: Dir not found/changed
  7199.         1039 WinClose: Window not found
  7200.         1040 WinHide: Window not found
  7201.         1041 WinIconize: Window not found
  7202.         1042 WinZoom: Window not found
  7203.         1043 WinShow: Window not found
  7204.         1044 WinPlace: Window not found
  7205.         1045 WinActivate: Window not found
  7206.  
  7207.  
  7208.         Moderate Errors
  7209.  
  7210.         If the error mode is @NOTIFY or @OFF, the user has the option of
  7211.         continuing with the batch file or canceling it.
  7212.  
  7213.         2002 File Copy/Move: 'From' file illegal
  7214.         2003 File Copy/Move: 'To'   file illegal
  7215.         2004 File Copy/Move: Cannot copy/move wildcards into fixed root
  7216.         2005 File Copy/Move: Cannot copy/move wildcards into fixed
  7217.              extension
  7218.         2007 File Move: Unable to rename source file
  7219.         2015 File Move:  Unable to remove source file
  7220.         2016 File Delete: File name illegal
  7221.         2019 File Rename: 'From' file illegal
  7222.         2020 File Rename: 'To' file illegal
  7223.         2021 File Rename: Attempt to rename across drive boundary. - Use
  7224.              MOVE instead.
  7225.         2022 File Rename: Cannot rename wildcards into a fixed filename
  7226.              root
  7227.         2023 File Rename: Cannot rename wildcards into a fixed filename
  7228.              extension
  7229.  
  7230.  
  7231.  
  7232.  
  7233.                                                                       101
  7234.  
  7235.         APPENDIX B    Errors
  7236.  
  7237.  
  7238.  
  7239.         2038 WinCloseNot Function Syntax error
  7240.         2058 StrCat function syntax error
  7241.         2060 Average function syntax error
  7242.  
  7243.  
  7244.         Fatal Errors
  7245.  
  7246.         Fatal errors cause the current batch file to be canceled with an
  7247.         error message, regardless of the error mode in effect.  (We show
  7248.         the error codes here for consistency, but in practice you will
  7249.         never be able to call LastError after a fatal error.)
  7250.  
  7251.         3008 File Copy/Move: 'From' file open error
  7252.         3011 File Copy/Move: 'From' file length error
  7253.         3012 File Copy/Move: No room left on disk.  Out of space??
  7254.         3013 File Copy/Move: 'To' file open error
  7255.         3014 File Copy/Move: I/O Error
  7256.         3026 LogDisk: Illegal disk drive
  7257.         3027 LogDisk: DOS reports no disks!!  ???
  7258.         3034 Clipboard owned by another app.  Cannot open.
  7259.         3035 Clipboard does not contain text for ClipAppend.
  7260.         3036 Clipboard cannot hold that much text (>64000 bytes)
  7261.         3037 Unable to allocate memory for clipboard.  Close some
  7262.              applications
  7263.         3046 Internal Error 3046. Function not defined
  7264.         3047 Variable name over 30 chars. Too Long
  7265.         3048 Substitution %Variable% not followed by a % (Use %% for %)
  7266.         3049 No variables exist??!!
  7267.         3050 Undefined variable
  7268.         3051 Undefined variable or function
  7269.         3052 Uninitialized variable or undefined function
  7270.         3053 Character string too long (>256 chars??)
  7271.         3054 Unrecognizable item found on line
  7272.         3055 Variable name is over 30 chars. Too Long
  7273.         3056 Variable could not be converted to string
  7274.         3057 Variable could not be converted to integer
  7275.         3059 Illegal Bounds for StrSub function
  7276.         3061 Illegal Syntax
  7277.         3062 Attempt to divide by zero
  7278.         3063 Internal Error 3063. Binary op not found
  7279.         3064 Internal Error 3064. Unary op not found
  7280.         3065 Unbalanced Parenthesis
  7281.         3066 Wrong Number of Arguments in Function
  7282.         3067 Function Syntax. Opening parenthesis missing.
  7283.         3068 Function Syntax. Illegal delimiter found.
  7284.         3069 Illegal assignment statement. (Use == for equality testing)
  7285.         3070 Internal error 3070.  Too many arguments defined.
  7286.         3071 Missing or incomplete statement
  7287.         3074 Expression continues past expected end.
  7288.         3081 FileRead: Invalid file handle
  7289.         3082 FileRead: File not currently open
  7290.         3084 FileWrite: Invalid file handle
  7291.         3085 FileWrite: File not currently open
  7292.         3087 FileRead:  File not open for reading
  7293.  
  7294.  
  7295.  
  7296.  
  7297.  
  7298.         102
  7299.  
  7300.                                                      APPENDIX B    Errors
  7301.  
  7302.  
  7303.  
  7304.         3088 FileRead: Attempt to read past end of file
  7305.         3089 FileWrite: File not open for writing
  7306.         3095 Compare could not be resolved into a integer or string
  7307.              compare
  7308.         3096 Memory allocation failure.  Out of memory for string storage
  7309.         3097 Memory allocation failure.  Out of memory for variable
  7310.              storage
  7311.         3098 Internal error, NULL pointer passed to xstrxxx subroutines
  7312.         3100 StrIndex/StrScan 3rd parameter out of bounds
  7313.         3101 Substituted line too long. (> 256 characters)
  7314.         3102 Drop: Can only drop variables
  7315.         3103 IsDefined: Attempting to test non-variables item
  7316.         3107 Run:  Filetype is not COM, EXE, PIF or BAT
  7317.         3108 FileItemize: Unable to lock file info segment
  7318.         3109 FileItemize: Unable to unlock file info segment
  7319.         3110 FileItemize: Unable to lock file index segment
  7320.         3111 FileItemize: Unable to unlock file index segment
  7321.         3112 FileSize:  File Not Found
  7322.         3113 FileSize:  Filelength I/O Error
  7323.         3114 FileSize:  Buffer Overrun Error
  7324.         3115 FileDelete: Buffer Overrun Error
  7325.         3116 FileRename: Buffer Overrun Error
  7326.         3117 FileCopyMove: Buffer Overrun Error
  7327.         3118 FileCopyMove: Destination file same as source
  7328.  
  7329.  
  7330.  
  7331.  
  7332.  
  7333.  
  7334.  
  7335.  
  7336.  
  7337.  
  7338.  
  7339.  
  7340.  
  7341.  
  7342.  
  7343.  
  7344.  
  7345.  
  7346.  
  7347.  
  7348.  
  7349.  
  7350.  
  7351.  
  7352.  
  7353.  
  7354.  
  7355.  
  7356.  
  7357.  
  7358.  
  7359.  
  7360.  
  7361.  
  7362.                                                                       103
  7363.  
  7364.                                                                     Index
  7365.  
  7366.  
  7367.  
  7368.  
  7369.                                      Index
  7370.  
  7371.                                            minor  101
  7372.         A                                  moderate  101-102
  7373.         Abs  36,40                         see also   Debug,
  7374.         AskLine  12,32,40-41                   ErrorMode, LastError
  7375.         AskYesNo  12,32,41               Exclusive  37,55
  7376.         Average  36,41-42                Execute  37,54
  7377.                                          Exit  37,54-55
  7378.         B
  7379.         batch files                      F
  7380.          error handling  31-32           File Management
  7381.          statement summary  32-37          in WBL  32-33
  7382.          statements  37-100              FileClose  32,55-56
  7383.          WBL language components  27-    FileCopy  17,32,55-56
  7384.          31                              FileDelete  17,32,56-57
  7385.         Beep  12,32,13                   FileExist  17,32,57-58
  7386.                                          FileExtension  33,58
  7387.         C                                FileItemize  20,33,58-59
  7388.         Call  36,42                      FileLocate  33,59-60
  7389.         CallExt  36,42-43                FileMove  33,60
  7390.         Char2Num  35,42-43               FileOpen  33,60-61
  7391.         ClipAppend  36,43-44             FilePath  33,61
  7392.         ClipGet  36,44-45                FileRead  33,61-62
  7393.         ClipPut  36,45                   FileRename  17,33,60-63
  7394.         Comments  30                     FileRoot  33,63
  7395.         Constants  27-28                 FileSize  33,63-64
  7396.          predefined  27-28               FileWrite  33,64
  7397.  
  7398.         D                                G
  7399.         DateTime  36,45-46               Goto  37,64
  7400.         Debug  36,46-47
  7401.         Delay  13,36,47                  I
  7402.         DialogBox  32,47                 Identifiers  28
  7403.         DirChange  16,33,47-48           If_Then  37,64-65
  7404.         Directory Management             IgnoreInput  37,65
  7405.          in WBL  33                      IniRead  37,64-66
  7406.         DirGet  16,33,48                 IniReadPvt  37,66
  7407.         DirHome  33,48-49                IniWrite  37,66-67
  7408.         DirItemize  21,33,49             IniWritePvt  37,67
  7409.         DirMake  33,49-50                IsDefined  37,67-68
  7410.         DirRemove  33,50                 IsKeyDown  37,68
  7411.         DiskFree  33,50-51               IsLicensed  37,68-69
  7412.         Display  12,32,51                IsNumber  35,68-69
  7413.         DOSVersion  36,51-52             ItemSelect  20,32,69-70
  7414.         Drop  36,51-52
  7415.                                          K
  7416.         E                                Keywords  28
  7417.         EndSession  16,36,52-53
  7418.         Environment  24,36,53            L
  7419.         ErrorMode  18,36,19              LastError  37,70-71
  7420.         Errors  31-32,101-107            LogDisk  33,71
  7421.          fatal  102-107
  7422.  
  7423.  
  7424.  
  7425.  
  7426.                                                                       105
  7427.  
  7428.  
  7429.  
  7430.  
  7431.  
  7432.                                          StrIndex  35,83
  7433.         M                                StrLen  35,83-84
  7434.         Max  36,71-72                    StrLower  35,84
  7435.         Message  12,32,72                StrReplace  35,84-85
  7436.         Microsoft Windows                StrScan  35,84-86
  7437.          date & time formatting  45      StrSub  35,86
  7438.          determining the version         StrTrim  35,86-87
  7439.          37,97                           StrUpper  35,87
  7440.          ending the session  52          Substitution  30-31
  7441.         Min  36,72-73                      and StrCat  78-80
  7442.  
  7443.         N                                T
  7444.         Num2Char  22,35,72-73            TextBox  32,87-88
  7445.  
  7446.         O                                V
  7447.         Operators  28-29                 Variables  28
  7448.          Precedence  29                  Version  37,88
  7449.  
  7450.         P                                W
  7451.         ParseData  35,73-74              WinActivate  14,34,88-89
  7452.         Pause  12,32,73-74               WinArrange  34,89
  7453.                                          WinClose  14,34,89-90
  7454.         R                                WinCloseNot  14,34,90-91
  7455.         Random  36,74                    WinConfig  34,91
  7456.         Registration  109                Window Management
  7457.         Return  37,74-75                   in WBL  33-34
  7458.         Run  11,34,74-75                 WinExist  15,34,91-92
  7459.         RunHide  34,75-76                WinGetActive  34,91-92
  7460.         RunIcon  11,34,76-77             WinHide  34,92-93
  7461.         Running programs                 WinIconize  13,34,93
  7462.          in WBL  34-35                   WinItemize  34,93-94
  7463.         RunZoom  11,35,77-78             WinPlace  34,94-95
  7464.                                          WinPosition  34,95
  7465.         S                                WinShow  13,34,95-96
  7466.         SendKey  24,37,78-79             WinTitle  34,96-97
  7467.         SKDebug  37,79                   WinVersion  37,97
  7468.         Statements  30                   WinWaitClose  15,34,97-98
  7469.          reference  37-100               WinZoom  13,34,98-99
  7470.         StrCat  23,35,78-80
  7471.         StrCmp  35,80-81                 Y
  7472.         StrFill  35,81                   Yield  37,99
  7473.         StrFix  35,81-82
  7474.         StrICmp  35,82-83
  7475.  
  7476.  
  7477.  
  7478.  
  7479.  
  7480.  
  7481.  
  7482.  
  7483.  
  7484.  
  7485.  
  7486.  
  7487.  
  7488.  
  7489.  
  7490.         106
  7491.  
  7492.  
  7493.  
  7494.  
  7495.  
  7496.                                    I want my OWN copy
  7497.                                       of WinBatch!
  7498.                                    Please send it to:
  7499.  
  7500.  
  7501.  
  7502.           Company:__________________________________________________________
  7503.  
  7504.              Name:__________________________________________________________
  7505.  
  7506.           Address:__________________________________________________________
  7507.  
  7508.              City:_____________________________St:__________Zip:____________
  7509.  
  7510.  
  7511.             Phone:(_____)___________________  Country: _____________________
  7512.  
  7513.  
  7514.  
  7515.                          ____WinBatch(es) @$69.95 ea.:____________
  7516.  
  7517.           Foreign air shipping (except Canada) @$9.50:____________
  7518.  
  7519.                                                 Total:____________
  7520.  
  7521.           Please enclose a check payable to Wilson WindowWare; or you may use
  7522.           Visa, Master Card, or EuroCard.  For charge cards, please enter
  7523.           the information below:
  7524.  
  7525.           Card number:   __ __ __ __-__ __ __ __-__ __ __ __-__ __ __ __
  7526.           Expiration date: _______/______
  7527.  
  7528.           Signature:_________________________________________________________
  7529.  
  7530.  
  7531.                Send to:  Wilson WindowWare
  7532.                           2701 California Ave SW #212
  7533.                           Seattle, WA 98116
  7534.                           USA
  7535.  
  7536.                or call:     (800) 762-8383
  7537.                             (206) 935-7129  (fax)
  7538.  
  7539.                         (Please allow 2 to 4 weeks for delivery)
  7540.